billbarker    01/12/12 20:20:06

  Modified:    src/facade22/org/apache/tomcat/facade
                        LoadOnStartupInterceptor.java
  Log:
  Fix behavior when servlet is a JspFile.
  
  Fix for bug #5390.
  Reported by: Mike [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.4       +19 -22    
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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LoadOnStartupInterceptor.java     2001/06/28 07:10:01     1.3
  +++ LoadOnStartupInterceptor.java     2001/12/13 04:20:06     1.4
  @@ -132,9 +132,8 @@
                            ((ServletHandler)result).getServletInfo().
                            getJspFile() != null ) {
                            loadJsp( ctx, result );
  -                     } else {
  -                         ((ServletHandler)result).init();
                        }
  +                     ((ServletHandler)result).init();
                    } catch (Throwable ee) {
                        // it can be ClassNotFound or other - servlet errors
                        // shouldn't stop initialization
  @@ -155,29 +154,27 @@
        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();
  -     Request request = new Request();
  -     Response response = new Response();
  -     request.recycle();
  -     response.recycle();
  -     cm.initRequest(request,response);
  -     
        String requestURI = path + "?jsp_precompile=true";
  -
  -     if( !path.startsWith( "/" ) ) path="/" + path;
  -     request.requestURI().setString(context.getPath() + path);
  -
  -     // this is not used with JspInterceptor, but maybe a jsp servlet is
  -     // used
  -     request.queryString().setString( "jsp_precompile=true" );
  -     
  -     request.setContext(context);
  -
  -     //cm.service( request, response );
  -     // If we switch to JspInterceptor, it's enough to process the
  -     // request, it'll detect the page and precompile
  -     cm.processRequest( request );
  +     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 ;
  +     }
       }
       // -------------------- 
       // Old logic from Context - probably something cleaner can replace it.
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to