cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java Request.java

2001-08-28 Thread costin

costin  01/08/28 22:01:24

  Modified:src/share/org/apache/tomcat/core ContextManager.java
Request.java
  Log:
  Extra messages and checks.
  
  Revision  ChangesPath
  1.190 +4 -0  
jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.189
  retrieving revision 1.190
  diff -u -r1.189 -r1.190
  --- ContextManager.java   2001/08/21 04:55:39 1.189
  +++ ContextManager.java   2001/08/29 05:01:24 1.190
  @@ -1090,6 +1090,10 @@
else
ri=req.getContext().getContainer().
getInterceptors( Container.H_handleError );
  + if( ri==null ) {
  + log( handleError with no error handlers  + req +   + req.getContext());
  + return;
  + }
for( int i=0; i ri.length; i++ ) {
status=ri[i].handleError( req, res, t );
if( status!=0 ) return;
  
  
  
  1.110 +5 -0  jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java
  
  Index: Request.java
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- Request.java  2001/08/17 04:02:54 1.109
  +++ Request.java  2001/08/29 05:01:24 1.110
  @@ -72,6 +72,7 @@
   
   import java.security.Principal;
   import java.io.IOException;
  +import java.io.CharConversionException;
   import java.util.Enumeration;
   import java.util.Hashtable;
   
  @@ -430,6 +431,10 @@
handleQueryParameters();
   
params.processParameters( formData, 0, available );
  + } catch(java.io.CharConversionException cex ) {
  + contextM.log(CharConversionException processing parameters: 
  +  + this ++ cex.toString());
  + 
} catch(IOException ex ) {
ex.printStackTrace();
// XXX should we throw exception or log ?
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java Request.java

2001-04-21 Thread costin

costin  01/04/21 11:36:08

  Modified:src/share/org/apache/tomcat/core ContextManager.java
Request.java
  Log:
  Core changes !!!
  
  engineShutdown() hook is supposed to be called when tomcat is shut down ( and modules
  must clean up resources ). The interceptor can be added/removed at any time -
  it must clean after itself on removeInterceptor - but it shouldn't get a shutdown
  notification when it's removed ( since the server will still work ).
  
  Also, shutdown will no longer remove contexts - since init() didn't add them. Whoever
  adds the contexts ( i.e. config modules ) should also remove them - if they want -
  on server stop/restart. ( the context should be cleaned up on contextShutdown, but
  it may remain added - the server will report "application unavailable" instead of
  not found ).
  
  Also, shutdown will not remove interceptors - since it didn't add them.
  
  A init-start-stop-shutdown whould return to the same state as before init
  ( i.e. the configuration hardcoded in context manager like modules and settings
  must remain ).
  
  A shutdown-init should bring the server in ready state, and after start it should
  work as before.
  
  Revision  ChangesPath
  1.177 +33 -7 
jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.176
  retrieving revision 1.177
  diff -u -r1.176 -r1.177
  --- ContextManager.java   2001/04/07 06:50:55 1.176
  +++ ContextManager.java   2001/04/21 18:36:07 1.177
  @@ -482,7 +482,6 @@
}
}
   
  - ri.engineShutdown( this );
   }
   
   //  Server functions 
  @@ -577,22 +576,49 @@
*/
   public final void shutdown() throws TomcatException {
   if( state==STATE_START ) stop();
  - while (!contextsV.isEmpty()) {
  +
  + Enumeration enum = getContexts();
  + while (enum.hasMoreElements()) {
  + Context ctx = (Context)enum.nextElement();
try {
  - removeContext((Context)contextsV.firstElement());
  - } catch(Exception ex ) {
  - log( "shutdown.removeContext" , ex );
  + ctx.shutdown();
  + } catch( TomcatException ex ) {
  + log( "Error shuting down context " +ctx );
}
}
  + // No need to remove - since init() doesn't add the contexts.
  + // Modules could remove contexts ( and add them in init() ), but who
  + // adds should also remove
  + //  while (!contextsV.isEmpty()) {
  + //  try {
  + //  Context ctx=(Context)contextsV.firstElement();
  + //  removeContext(ctx);
  + //  } catch(Exception ex ) {
  + //  log( "shutdown.removeContext" , ex );
  + //  }
  + //  }
  +
  + // Notify all modules that the server will shutdown,
  + // let them clean up all resources
   
BaseInterceptor cI[]=defaultContainer.getInterceptors();
for( int i=0; i cI.length; i++ ) {
try {
  - removeInterceptor( cI[i] );
  + cI[i].engineShutdown( this );
} catch( Exception ex ) {
  - log( "shutdown.removeInterceptor" , ex );
  + log( "shutdown.engineShutdown" , ex );
}
}
  +
  + setState( STATE_NEW );
  + // remove the modules ( XXX do we need that ? )
  + //  for( int i=0; i cI.length; i++ ) {
  + //  try {
  + //  removeInterceptor( cI[i] );
  + //  } catch( Exception ex ) {
  + //  log( "shutdown.removeInterceptor" , ex );
  + //  }
  + //  }
   }
   
   //  Contexts 
  
  
  
  1.100 +4 -0  jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java
  
  Index: Request.java
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- Request.java  2001/04/10 06:26:14 1.99
  +++ Request.java  2001/04/21 18:36:07 1.100
  @@ -298,6 +298,10 @@
return uriMB;
   }
   
  +public MessageBytes query() {
  + return queryMB;
  +}
  +
   public MessageBytes queryString() {
return queryMB;
   }