// host=req.serverName().toString();
if(debug>0) cm.log("Host = " + hostMB.toString());
Container container =(Container)map.
getLongestPrefixMatch( hostMB, pathMB);
if( container == null ) {
// It is too easy to configure Tomcat w/o a default context
// Add this back in when we do better checking
//throw new RuntimeException( "Assertion failed: " +
// "container==null");
cm.log("Assertion failed: " +
"container==null (no Default Context?)");
return 404;
}
if(debug>0)
cm.log("SM: Prefix match " + pathMB.toString() + " -> " +
container.getPath() + " " + container.getHandler() +
" " + container.getRoles());
// Once - adjust for prefix and context path
// If cached - we don't need to do it again ( since it is the
// final Container,
// either prefix or extension )
fixRequestPaths( pathMB.toString() /*XXX*/, req, container );
// if it's default container - try extension match
// if ( container.getMapType() == Container.DEFAULT_MAP ) {
if ( container.getHandler() == null ) {
Container extC = matchExtension( req );
if( extC != null ) {
// change the handler
if( extC.getHandler() != null ) {
fixRequestPaths( pathMB.toString(), req, extC );
container=extC;
}
if( debug > 0 )
log("SM: Found extension mapping " +
extC.getHandler());
// change security roles
}
}
// Default map - if present
if( container.getHandler() == null ) {
Container ctxDef=req.getContext().getContainer();
Container defC=(Container)ctxDef.getNote( defaultMapNOTE );
if( defC != null && defC.getHandler() !=null ) {
fixRequestPaths( pathMB.toString(), req, defC );
if( debug > 0 )
log("SM: Found default mapping " +
defC.getHandler() + " " + defC.getPath() +
" " + defC.getMapType());
}
}
if(debug>0) log("SM: After mapping " + req + " " +
req.getHandler());