cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade ServletHandler.java Servlet22Interceptor.java ServletOutputStreamFacade.java ServletWriterFacade.java JspInterceptor.java SessionContextImpl.java HttpSessionFacade.java HttpServletRequestFacade.java WebXmlReader.java ServletInputStreamFacade.java LoadOnStartupInterceptor.java RequestDispatcherImpl.java ServletInfo.java CookieFacade.java ServletConfigImpl.java

2003-09-22 Thread hgomez
hgomez  2003/09/22 02:17:18

  Modified:src/facade22/org/apache/tomcat/facade ServletHandler.java
Servlet22Interceptor.java
ServletOutputStreamFacade.java
ServletWriterFacade.java JspInterceptor.java
SessionContextImpl.java HttpSessionFacade.java
HttpServletRequestFacade.java WebXmlReader.java
ServletInputStreamFacade.java
LoadOnStartupInterceptor.java
RequestDispatcherImpl.java ServletInfo.java
CookieFacade.java ServletConfigImpl.java
  Log:
  First batch of imports cleanup in TC 3.3.2-dev
  
  Revision  ChangesPath
  1.21  +13 -7 
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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ServletHandler.java   5 Jun 2002 03:52:50 -   1.20
  +++ ServletHandler.java   22 Sep 2003 09:17:17 -  1.21
  @@ -58,14 +58,20 @@
*/ 
   package org.apache.tomcat.facade;
   
  -import org.apache.tomcat.core.*;
  -import org.apache.tomcat.util.collections.*;
  +import javax.servlet.Servlet;
  +import javax.servlet.SingleThreadModel;
  +import javax.servlet.UnavailableException;
  +import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpServletResponse;
   
  -import java.io.*;
  -import java.net.*;
  -import java.util.*;
  -import javax.servlet.*;
  -import javax.servlet.http.*;
  +import org.apache.tomcat.core.BaseInterceptor;
  +import org.apache.tomcat.core.Container;
  +import org.apache.tomcat.core.Context;
  +import org.apache.tomcat.core.Handler;
  +import org.apache.tomcat.core.Request;
  +import org.apache.tomcat.core.Response;
  +import org.apache.tomcat.core.TomcatException;
  +import org.apache.tomcat.util.collections.SimplePool;
   
   /**
* Handler for servlets. It'll implement all servlet-specific
  
  
  
  1.23  +18 -8 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/Servlet22Interceptor.java
  
  Index: Servlet22Interceptor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/Servlet22Interceptor.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Servlet22Interceptor.java 15 Jan 2003 06:11:23 -  1.22
  +++ Servlet22Interceptor.java 22 Sep 2003 09:17:17 -  1.23
  @@ -60,16 +60,26 @@
   
   package org.apache.tomcat.facade;
   
  -import org.apache.tomcat.util.*;
  +import java.util.Enumeration;
  +import java.util.Vector;
  +
  +import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpServletResponse;
  +import javax.servlet.http.HttpSession;
  +import javax.servlet.http.HttpSessionBindingEvent;
  +import javax.servlet.http.HttpSessionBindingListener;
  +
  +import org.apache.tomcat.core.BaseInterceptor;
  +import org.apache.tomcat.core.Container;
  +import org.apache.tomcat.core.Context;
  +import org.apache.tomcat.core.ContextManager;
  +import org.apache.tomcat.core.Handler;
  +import org.apache.tomcat.core.Request;
  +import org.apache.tomcat.core.Response;
  +import org.apache.tomcat.core.ServerSession;
  +import org.apache.tomcat.core.TomcatException;
   import org.apache.tomcat.util.collections.SimplePool;
   import org.apache.tomcat.util.compat.Jdk11Compat;
  -import org.apache.tomcat.core.*;
  -import java.io.*;
  -import java.net.*;
  -import java.security.*;
  -import java.util.*;
  -import javax.servlet.*;
  -import javax.servlet.http.*;
   
   /**
*   Control class for facades - this is the only gate between servlets
  
  
  
  1.6   +5 -3  
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletOutputStreamFacade.java
  
  Index: ServletOutputStreamFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletOutputStreamFacade.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ServletOutputStreamFacade.java3 Jun 2002 17:25:00 -   1.5
  +++ ServletOutputStreamFacade.java22 Sep 2003 09:17:17 -  1.6
  @@ -60,10 +60,12 @@
   
   package org.apache.tomcat.facade;
   
  -import org.apache.tomcat.core.*;
  -import org.apache.tomcat.util.*;
  -import java.io.*;
  +import java.io.IOException;
  +
   import javax.servlet.ServletOutputStream;
  +
  +import org.apache.tomcat.core.OutputBuffer;
  +import org.apache.tomcat.core.Response;
   
   /**
* 
  
  
  
  1.6   +5 -4  

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

2001-09-17 Thread larryi

larryi  01/09/17 19:37:40

  Modified:src/facade22/org/apache/tomcat/facade ServletHandler.java
  Log:
  Moved synchronization to the method for init().  Insures we don't run into
  problem with double checked locking.
  
  Since service() already checks the state before calling init(), this change
  shouldn't cause any additional performance hit.
  
  Revision  ChangesPath
  1.17  +58 -74
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ServletHandler.java   2001/09/14 12:09:27 1.16
  +++ ServletHandler.java   2001/09/18 02:37:40 1.17
  @@ -202,91 +202,75 @@
*  This is a final method to insure consistent behavior on errors.
*  It also saves handlers from dealing with synchronization issues.
*/
  -public final void init()
  +public final synchronized void init()
   {
// we use getState() as a workaround for bugs in VMs

if( getState() == STATE_READY || getState() == STATE_DISABLED )
return;
   
  - synchronized( this ) {
  - // check again - if 2 threads are in init(), the first one will
  - // init and the second will enter the sync block after that
  - if( getState() == STATE_READY ) 
  - return;
  -
  - // if exception present, then we were sync blocked when first
  - // init() failed or an interceptor set an inital exeception
  - // A different thread got an error in init() - throw
  - // the same error.
  - if (getState() == STATE_DISABLED )
  - return; //throw errorException;
  -
  - try {
  - // special preInit() hook
  - preInit();
  - // preInit may either throw exception or setState DELAYED_INIT
  - } catch( ClassNotFoundException ex ) {
  - log( context, Class not found:  + servletClassName);
  - setErrorException(ex);
  - setState(STATE_DISABLED);
  - } catch( Exception ex ) {
  - // save error, assume permanent
  - log(context, Exception in preInit  + ex.getMessage(), ex );
  - setErrorException(ex);
  - setState(STATE_DISABLED);
  - return;
  - }
  + try {
  + // special preInit() hook
  + preInit();
  + // preInit may either throw exception or setState DELAYED_INIT
  + } catch( ClassNotFoundException ex ) {
  + log( context, Class not found:  + servletClassName);
  + setErrorException(ex);
  + setState(STATE_DISABLED);
  + return;
  + } catch( Exception ex ) {
  + // save error, assume permanent
  + log(context, Exception in preInit  + ex.getMessage(), ex );
  + setErrorException(ex);
  + setState(STATE_DISABLED);
  + return;
  + }

  - // we'll try again later 
  - if( getState() == STATE_DELAYED_INIT ||
  - getState()==STATE_DISABLED ) { // or disabled 
  - return;
  - }
  - // preInit have no exceptions and doesn't delay us
  - // We can run init hooks and init
  -
  - // Call pre, doInit and post
  - BaseInterceptor cI[]=context.getContainer().getInterceptors();
  - for( int i=0; i cI.length; i++ ) {
  - try {
  - cI[i].preServletInit( context, this );
  - } catch( TomcatException ex) {
  - // log, but ignore.
  - log(context, preServletInit , ex);
  - }
  - }
  - 
  + // we'll try again later 
  + if( getState() == STATE_DELAYED_INIT ||
  + getState()==STATE_DISABLED ) { // or disabled 
  + return;
  + }
  + // preInit have no exceptions and doesn't delay us
  + // We can run init hooks and init
  +
  + // Call pre, doInit and post
  + BaseInterceptor cI[]=context.getContainer().getInterceptors();
  + for( int i=0; i cI.length; i++ ) {
try {
  - doInit();
  - // if success, we are ready to serve
  - } catch( Exception ex ) {
  - // save error, assume permanent
  - log(context, Exception in init   + ex.getMessage(), ex );
  - setErrorException(ex);
  - state=STATE_DISABLED;
  + cI[i].preServletInit( context, this );
  + } catch( TomcatException ex) {
  + // log, but ignore.
  + log(context, preServletInit , ex);
}
  + }
  + 
  + try {
  + doInit();
  + // if success, we are ready to serve
 

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

2001-09-14 Thread larryi

larryi  01/09/14 05:09:27

  Modified:src/facade22/org/apache/tomcat/facade ServletHandler.java
  Log:
  Avoid NPE.
  
  Submitted by: Bojan Smojver [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.16  +1 -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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ServletHandler.java   2001/07/19 18:03:15 1.15
  +++ ServletHandler.java   2001/09/14 12:09:27 1.16
  @@ -158,7 +158,7 @@
servlet=null; // reset the servlet, if it was set
servletClass=null;
this.servletClassName=servletClassName;
  - if( debug0  sw.getJspFile()!=null)
  + if( debug0  sw!=null  sw.getJspFile()!=null)
log( context, setServletClassName for  + sw.getJspFile() +
 :  + servletClassName);
   }
  
  
  



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

2001-07-19 Thread costin

costin  01/07/19 11:03:15

  Modified:src/facade22/org/apache/tomcat/facade ServletHandler.java
  Log:
  Added the method from jasper34, is the only piece that prevents
  complete separation of runtime/compiler.
  
  Revision  ChangesPath
  1.15  +5 -0  
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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ServletHandler.java   2001/06/24 22:33:14 1.14
  +++ ServletHandler.java   2001/07/19 18:03:15 1.15
  @@ -643,5 +643,10 @@
return false;
   }
   
  +/** The handler may return a set of classes it depends on
  + */
  +public String [] _getDepends() {
  + return null;
  +}
   
   }
  
  
  



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

2001-06-24 Thread costin

costin  01/06/24 15:33:14

  Modified:src/facade22/org/apache/tomcat/facade ServletHandler.java
  Log:
  An old change that wasn't commited - we want all logs related with a webapp
  to go into the webapp log file ( if set ). The container log should be
  used only for global messages.
  
  ( the main benefit is that each webapp can have it's own file and no need to
  look into the main file - this is very good if you host apps and want
  minimal interference, the main log might have sensitive data about other
  apps )
  
  Revision  ChangesPath
  1.14  +33 -45
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ServletHandler.java   2001/02/06 06:36:25 1.13
  +++ ServletHandler.java   2001/06/24 22:33:14 1.14
  @@ -159,7 +159,7 @@
servletClass=null;
this.servletClassName=servletClassName;
if( debug0  sw.getJspFile()!=null)
  - log( setServletClassName for  + sw.getJspFile() +
  + log( context, setServletClassName for  + sw.getJspFile() +
 :  + servletClassName);
   }
   
  @@ -190,11 +190,7 @@
try {
doDestroy();
} catch( Exception ex ) {
  - if( context!=null )
  - context.log( Error during destroy , ex );
  - else
  - log( Error during destroy , ex );
  -
  + log(context,  Error during destroy , ex );
}

   
  @@ -230,13 +226,13 @@
// special preInit() hook
preInit();
// preInit may either throw exception or setState DELAYED_INIT
  + } catch( ClassNotFoundException ex ) {
  + log( context, Class not found:  + servletClassName);
  + setErrorException(ex);
  + setState(STATE_DISABLED);
} catch( Exception ex ) {
// save error, assume permanent
  - if(context!=null)
  - context.log(Exception in preInit   +
  - ex.getMessage(), ex );
  - else 
  - log(Exception in preInit   + ex.getMessage(), ex );
  + log(context, Exception in preInit  + ex.getMessage(), ex );
setErrorException(ex);
setState(STATE_DISABLED);
return;
  @@ -257,7 +253,7 @@
cI[i].preServletInit( context, this );
} catch( TomcatException ex) {
// log, but ignore.
  - log(preServletInit , ex);
  + log(context, preServletInit , ex);
}
}

  @@ -266,10 +262,7 @@
// if success, we are ready to serve
} catch( Exception ex ) {
// save error, assume permanent
  - if( context!=null )
  - context.log(Exception in init   + ex.getMessage(), ex );
  - else
  - log(Exception in init   + ex.getMessage(), ex );
  + log(context, Exception in init   + ex.getMessage(), ex );
setErrorException(ex);
state=STATE_DISABLED;
}
  @@ -278,7 +271,7 @@
try {
cI[i].postServletInit( context, this );
} catch( TomcatException ex) {
  - log(postServletInit , ex);
  + log(context, postServletInit , ex);
}
}
   
  @@ -297,7 +290,19 @@
}
   }
   
  -
  +private void log( Context ctx, String s ) {
  + if( ctx==null )
  + log( s );
  + else
  + ctx.log( s );
  +}
  +
  +private void log( Context ctx, String s, Throwable t ) {
  + if( ctx==null )
  + log( s, t );
  + else
  + ctx.log( s, t );
  +}
   
   //  
   
  @@ -306,10 +311,7 @@
try {
destroy();
} catch(Exception ex ) {
  - if( context!=null )
  - context.log( Error in destroy , ex );
  - else
  - log( Error in destroy , ex );
  + log(context,  Error in destroy , ex );
}
}
   
  @@ -331,7 +333,8 @@
return servlet;
   
if( debug0)
  - log(LoadServlet  + name +   + sw.getServletName() +   +
  + log(context, LoadServlet  + name +   +
  + sw.getServletName() +   +
sw.getServletClassName() +   + servletClass );
   
// default
  @@ -358,7 +361,7 @@
try {
cI[i].preServletDestroy( context, this );
} 

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

2001-02-05 Thread costin

costin  01/02/05 22:36:25

  Modified:src/facade22/org/apache/tomcat/facade ServletHandler.java
  Log:
  Coresponding changes in ServletHandler - the exceptions are propagated
  from included servlets ( instead of wrapping them )
  
  Revision  ChangesPath
  1.13  +11 -4 
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ServletHandler.java   2001/01/20 23:25:44 1.12
  +++ ServletHandler.java   2001/02/06 06:36:25 1.13
  @@ -427,7 +427,9 @@
   }
   
   // Overrides the default handler
  -public void service ( Request req, Response res ) {
  +public void service ( Request req, Response res )
  + throws Exception
  +{
if( state!=STATE_READY ) {
if( state!= STATE_DISABLED ) {
init();
  @@ -497,8 +499,8 @@
} else {
servlet.service(reqF, resF);
}
  - // catch just UnavailableException, so we can set a timer if needed
  - // other exceptions will be thrown
  + // catch just UnavailableException, so we can set a timer if needed
  + // other exceptions will be thrown
} catch ( UnavailableException ex ) {
// if new exception, save and set timer if necessary
if ( res.getErrorException() != ex ) {
  @@ -524,6 +526,7 @@
handleServiceError( req, res, ex );
return;
}
  + 
// clear any error exception since none were thrown
res.setErrorException(null);
res.setErrorURI(null);
  @@ -566,9 +569,13 @@
   }
   
   protected void handleServiceError( Request req, Response res, Throwable t )
  + throws Exception
   {
// if in included, defer handling to higher level
  - if (res.isIncluded()) return;
  + if (res.isIncluded()) {
  + throw (Exception)t;
  + }
  + // only for top-level servlets
handleError( req, res, t );
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




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

2000-12-14 Thread larryi

larryi  00/12/14 16:02:13

  Modified:src/facade22/org/apache/tomcat/facade ServletHandler.java
  Log:
  Adding an additional checkAvailable() method for use during service()
  handling.  It needs its own synchronization since multiple requests could
  try to expire the unavailable error.  For performance reasons, we don't
  want to use synchronization unless the unavailable time has expired.
  This requires the error exception be set on the request and response in this
  routine using known valid information.
  
  Revision  ChangesPath
  1.5   +48 -18
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServletHandler.java   2000/12/14 07:10:56 1.4
  +++ ServletHandler.java   2000/12/15 00:02:12 1.5
  @@ -97,7 +97,11 @@
* serve requests. If the handler is not in this state a 500 error
* should be reported. ( customize - may be 404 )
* To ADDED by calling destroy()
  + * To DISABLED if permanent UnavailableException in service()
* FROM ADDED by calling init()
  + *
  + * Note: Once this state is reached, only UnavailableExceptions are
  + * stored in errorException.
*/
   public static final int STATE_READY=3;
   
  @@ -445,21 +449,12 @@
   
   
// if unavailable
  - if( ! checkAvailable() ) {
  - // if error still present
  - Exception ex=getErrorException();
  - if( ex!=null ) {
  - // save error state on request and response
  - saveError( req, res, ex );
  - }
  - // if we have an error on this request
  - if ( req.isExceptionPresent()) {
  - // if in included, defer handling to higher level
  - if ( res.isIncluded() )
  - return;
  - // otherwise handle error
  - contextM.handleError( req, res, getErrorException());
  - }
  + if( ! checkAvailable( req, res ) ) {
  + // if in included, defer handling to higher level
  + if ( res.isIncluded() )
  + return;
  + // otherwise handle error
  + contextM.handleError( req, res, req.getErrorException());
return; // we can't handle it
}
   
  @@ -519,9 +514,12 @@
setErrorException( ex );
   }
   
  -/** Check if error exception is present and if so, has the error
  - expired.  Sets error on request and response if un-expired
  - error found.
  +/** Check if unavailable timer is present and if so, has the
  + unavailable time expired.  Two versions are needed.  The
  + first is used in init() handling which is itself synchronized.
  + The second is used in service() handling after initialization
  + is successful.  It needs its own synchronization since
  + multiple requests could try to expire the unavailable error.
*/
   private boolean checkAvailable() {
if( unavailableTime == -1 )
  @@ -537,6 +535,38 @@
" unavailable time expired, trying again ");
return true;
}
  + // still unavailable
  + return false;
  +}
  +
  +private boolean checkAvailable( Request req, Response res ) {
  + if( unavailableTime == -1 )
  + return true;
  +
  + // save a copy of current UnavailableException
  + Exception ex = getErrorException(); 
  + // if permanent exception this code isn't called
  + long moreTime = unavailableTime - System.currentTimeMillis();
  + // if timer expired
  + if ( moreTime  0) {
  + synchronized(this) {
  + // if another request hasn't expired the error
  + if ( unavailableTime != -1 ) {
  + // disable the error - it expired
  + setErrorException(null);
  + unavailableTime=-1;
  + log(getName() +
  + " unavailable time expired, trying again ");
  + }
  + return true;
  + }
  + }
  + // get seconds remaining with minimum of 1 second
  + int secs=1;
  + if( moreTime  0 )
  + secs = (int)((moreTime + 999) / 1000);
  + // save error state on request and response
  + saveError( req, res, new UnavailableException(ex.getMessage(), secs) );
// still unavailable
return false;
   }