// Now we need to fix path info and servlet path
if( servletPath == null ||
! servletPath.startsWith( prefix ))
return 0;
Context ctx=req.getContext();
// Set the wrapper, and add a new mapping - next time
// we'll not have to do that ( the simple mapper is
// supposed to be faster )
String servletName = null;
String newPathInfo = null;
if( debug>0 )
log( "Original ServletPath=" +servletPath +
" PathInfo=" + pathInfo);
int secondSlash=servletPath.indexOf("/", prefixLen );
if ( secondSlash > -1) {
servletName = servletPath.substring(prefixLen, secondSlash );
newPathInfo = servletPath.substring( secondSlash );
} else {
servletName = servletPath.substring( prefixLen );
}
String newServletPath = prefix + servletName;
if( debug > 0)
log( "After pathfix SN=" + servletName +
" SP=" + newServletPath +
" PI=" + newPathInfo);
req.servletPath().setString(newServletPath);
req.pathInfo().setString(newPathInfo);
Handler wrapper = ctx.getServletByName(servletName);
if (wrapper != null) {
req.setHandler( wrapper );
return 0;
}
// Dynamic add for the wrapper
// even if the server doesn't supports dynamic mappings,
// we'll avoid the interceptor for include() and
// it's a much cleaner way to construct the servlet and
// make sure all interceptors are up to date.
try {
ctx.addServletMapping( newServletPath + "/*" ,
servletName );
// The facade should create the servlet name
Handler sw=ctx.getServletByName( servletName );
// sw.setContext(ctx);
// sw.setServletName(servletName);
// ctx.addServlet( sw );
// sw.setServletClass( servletName );
//sw.setOrigin( Handler.ORIGIN_INVOKER );