cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade LoadOnStartupInterceptor.java ServletHandler.java

2002-02-10 Thread billbarker

billbarker02/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  ChangesPath
  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 -  1.4
  +++ LoadOnStartupInterceptor.java 11 Feb 2002 02:32:29 -  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 -  1.18
  +++ ServletHandler.java   11 Feb 2002 02:32:29 -  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]




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade LoadOnStartupInterceptor.java

2001-12-12 Thread billbarker

billbarker01/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  ChangesPath
  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]




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade LoadOnStartupInterceptor.java WebXmlReader.java

2001-06-28 Thread costin

costin  01/06/28 00:10:07

  Modified:src/facade22/org/apache/tomcat/facade
LoadOnStartupInterceptor.java WebXmlReader.java
  Log:
  Small fix in loadOnStartup: Throwables shouldn't be able to stop the startup.
  ( it happens in strange situations )
  
  Also, check if we validated before.( small speedup )
  
  Revision  ChangesPath
  1.3   +3 -1  
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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LoadOnStartupInterceptor.java 2001/02/20 03:34:11 1.2
  +++ LoadOnStartupInterceptor.java 2001/06/28 07:10:01 1.3
  @@ -135,7 +135,9 @@
} else {
((ServletHandler)result).init();
}
  - } catch (Exception ee) {
  + } catch (Throwable ee) {
  + // it can be ClassNotFound or other - servlet errors
  + // shouldn't stop initialization
String msg = sm.getString(context.loadServlet.e,
  servletName);
log(msg, ee);
  
  
  
  1.12  +16 -1 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/WebXmlReader.java
  
  Index: WebXmlReader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/WebXmlReader.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WebXmlReader.java 2001/02/20 03:34:11 1.11
  +++ WebXmlReader.java 2001/06/28 07:10:02 1.12
  @@ -136,8 +136,13 @@
}
if( ctx.getDebug()  0 ) ctx.log(Reading  + file );
XmlMapper xh=new XmlMapper();
  + File v=new File( ctx.getWorkDir(), webxmlval.txt );
if( validate ) {
  - xh.setValidating(true);
  + if( ! v.exists() || 
  + v.lastModified()  f.lastModified() ) {
  + ctx.log(Validating web.xml);
  + xh.setValidating(true);
  + }
//  if( ctx.getDebug()  5 ) xh.setDebug( 3 );
}
   
  @@ -226,6 +231,16 @@
addSecurity( xh );
   
Object ctx1=xh.readXml(f, ctx);
  +
  + if( validate ) {
  + try {
  + FileOutputStream fos=new FileOutputStream( v );
  + fos.write( 1 );
  + fos.close();
  + } catch(IOException ex ) {
  + ctx.log( Error creating validation mark , ex );
  + }
  + }
} catch(Exception ex ) {
log(ERROR reading  + file, ex);
// XXX we should invalidate the context and un-load it !!!