billbarker 02/02/10 18:32:30 Modified: src/facade22/org/apache/tomcat/facade LoadOnStartupInterceptor.java ServletHandler.java Log: Moved loadJsp from LoadOnStartupInterceptor to ServletHandler. There are too many ways to access a declared JSP, so centralize the hook to make certain that it gets compiled. In 3.3.2 we should probably add a 'prePreServletInit' hook to the API so that JspInterceptor can take care of these cases on it's own. Fix for bug #6348 Reported by: Vincent Massol [EMAIL PROTECTED] Revision Changes Path 1.5 +1 -27 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/LoadOnStartupInterceptor.java Index: LoadOnStartupInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/LoadOnStartupInterceptor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- LoadOnStartupInterceptor.java 13 Dec 2001 04:20:06 -0000 1.4 +++ LoadOnStartupInterceptor.java 11 Feb 2002 02:32:29 -0000 1.5 @@ -148,33 +148,7 @@ void loadJsp( Context context, Handler result ) throws Exception { // A Jsp initialized in web.xml - - - // Log ( since I never saw this code called, let me know if it does - // for you ) - log("Initializing JSP with JspWrapper"); - - // Ugly code to trick JSPServlet into loading this. - BaseInterceptor ri[]; - ContextManager cm=context.getContextManager(); - String path=((ServletHandler)result).getServletInfo().getJspFile(); - String requestURI = path + "?jsp_precompile=true"; - Request request = cm.createRequest(context, requestURI); - Response response = request.getResponse(); - request.setHandler(result); - /* If we switch to JspInterceptor, it's enough to process the - request, it'll detect the page and precompile. - Note, we can call ContextManager.processRequest since the one - thing we do know at this point is that the context isn't started. - However, we should be able go jump straight to requestMap. - */ - ri=context.getContainer(). - getInterceptors(Container.H_requestMap); - for( int i=0; i< ri.length; i++ ) { - if( debug > 1 ) - log( "RequestMap " + ri[i] ); - int status=ri[i].requestMap( request ); - if( status!=0 ) return ; - } + // Moved to ServletHandler. } // -------------------- // Old logic from Context - probably something cleaner can replace it. 1.19 +25 -1 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletHandler.java Index: ServletHandler.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletHandler.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ServletHandler.java 27 Oct 2001 02:55:20 -0000 1.18 +++ ServletHandler.java 11 Feb 2002 02:32:29 -0000 1.19 @@ -394,6 +394,28 @@ } } + /** Handle the case of a JSP servlet that JspInterceptor hasn't seen. + * This shouldn't be any of our business, but for the moment we have + * to help JspInterceptor out. + */ + void loadJsp( ) throws Exception{ + BaseInterceptor ri[]; + ContextManager cm=context.getContextManager(); + String path=sw.getJspFile(); + String requestURI = path + "?jsp_precompile=true"; + Request request = cm.createRequest(context, requestURI); + Response response = request.getResponse(); + request.setHandler(this); + + ri=context.getContainer(). + getInterceptors(Container.H_requestMap); + for( int i=0; i< ri.length; i++ ) { + if( debug > 1 ) + log( "RequestMap " + ri[i] ); + int status=ri[i].requestMap( request ); + if( status!=0 ) return ; + } + } // Special hook protected void preInit() throws Exception { @@ -406,7 +428,9 @@ // remain in STATE_DELAYED_INIT state return; } - + if(sw.getJspFile() != null && + (servletClassName==null || servletClassName==name )) + loadJsp(); // clear STATE_DELAYED_INIT if set setState( STATE_ADDED );
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>