tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/session SessionSerializer.java
Date Wed, 02 Aug 2000 02:17:31 GMT
costin      00/08/01 19:17:30

  Modified:    src/share/org/apache/tomcat/context DefaultCMSetter.java
                        LoadOnStartupInterceptor.java LogEvents.java
                        WebXmlReader.java
               src/share/org/apache/tomcat/core BaseInterceptor.java
                        Container.java Context.java ContextInterceptor.java
                        ContextManager.java FacadeManager.java Handler.java
                        Request.java RequestImpl.java Response.java
                        ResponseImpl.java ServletWrapper.java
               src/share/org/apache/tomcat/facade
                        HttpServletResponseFacade.java
                        RequestDispatcherImpl.java
                        ServletContextFacade.java SimpleFacadeManager.java
               src/share/org/apache/tomcat/request AccessInterceptor.java
                        InvokerInterceptor.java Jdk12Interceptor.java
                        JspInterceptor.java StaticInterceptor.java
               src/share/org/apache/tomcat/session SessionSerializer.java
  Log:
  Replaced ServletWrapper with Handler ( step 1 )
  
  Other changes ( related - part of SW -> H ):
  - mappings without a servlet will throw an exception - make sure web.xml
  is valid ( tomcat had a workaround, but other containers may not)
  
  - remove addServlet( String, String ) - we may have different implementations
  of Handler ( like JspServlet) and it's better to give more control( plus it
  had all the jsp paths inside ).
  
  - in Context.reload(), we'll call sw.reload() instead of guessing if the
  handler can reload. This simplifies both Context and Handler ( fewer
  interdeps )
  
  Unrelated changes ( sorry about that ):
  - fixed the bug related with writer/stream use ( Response, ResponseImpl,
  HttpServletFacade )
  
  Revision  Changes    Path
  1.47      +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- DefaultCMSetter.java	2000/07/11 02:30:48	1.46
  +++ DefaultCMSetter.java	2000/08/02 02:17:06	1.47
  @@ -134,7 +134,7 @@
   
   }
   
  -class NotFoundHandler extends ServletWrapper {
  +class NotFoundHandler extends Handler {
       static StringManager sm=StringManager.
   	getManager("org.apache.tomcat.resources");
   
  @@ -183,7 +183,7 @@
       }
   }
   
  -class ExceptionHandler extends ServletWrapper {
  +class ExceptionHandler extends Handler {
       static StringManager sm=StringManager.
   	getManager("org.apache.tomcat.resources");
   
  @@ -250,7 +250,7 @@
       }
   }
   
  -class StatusHandler extends ServletWrapper {
  +class StatusHandler extends Handler {
       static StringManager sm=StringManager.
   	getManager("org.apache.tomcat.resources");
   
  @@ -303,7 +303,7 @@
       }
   }
   	
  -class RedirectHandler extends ServletWrapper {
  +class RedirectHandler extends Handler {
       static StringManager sm=StringManager.
   	getManager("org.apache.tomcat.resources");
   
  
  
  
  1.17      +2 -2      jakarta-tomcat/src/share/org/apache/tomcat/context/LoadOnStartupInterceptor.java
  
  Index: LoadOnStartupInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/LoadOnStartupInterceptor.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- LoadOnStartupInterceptor.java	2000/07/11 03:48:40	1.16
  +++ LoadOnStartupInterceptor.java	2000/08/02 02:17:07	1.17
  @@ -118,7 +118,7 @@
   	    Enumeration sOnLevel =  ((Vector)loadableServlets.get( key )).elements();
   	    while (sOnLevel.hasMoreElements()) {
   		String servletName = (String)sOnLevel.nextElement();
  -		ServletWrapper  result = ctx.getServletByName(servletName);
  +		ServletWrapper  result = (ServletWrapper)ctx.getServletByName(servletName);
   
   		if( ctx.getDebug() > 0 ) ctx.log("Loading " + key + " "  + servletName );
   		if(result==null)
  @@ -181,7 +181,7 @@
   	Enumeration enum=ctx.getServletNames();
   	while(enum.hasMoreElements()) {
   	    String name=(String)enum.nextElement();
  -	    ServletWrapper sw=ctx.getServletByName( name );
  +	    Handler sw= ctx.getServletByName( name );
   	    int i=sw.getLoadOnStartUp();
   	    Integer level=new Integer(i);
   	    if( i!= 0) {
  
  
  
  1.5       +7 -7      jakarta-tomcat/src/share/org/apache/tomcat/context/LogEvents.java
  
  Index: LogEvents.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/LogEvents.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LogEvents.java	2000/06/23 02:16:18	1.4
  +++ LogEvents.java	2000/08/02 02:17:07	1.5
  @@ -120,17 +120,17 @@
   
       /** Notify when a new servlet is added
        */
  -    public void addServlet( Context ctx, ServletWrapper sw) throws TomcatException {
  +    public void addServlet( Context ctx, Handler sw) throws TomcatException {
   	ctx.log( "Add servlet " + sw);
       }
       
       /** Notify when a servlet is removed from context
        */
  -    public void removeServlet( Context ctx, ServletWrapper sw) throws TomcatException {
  +    public void removeServlet( Context ctx, Handler sw) throws TomcatException {
   	ctx.log( "Remove servlet " + sw);
       }
   
  -    public void addMapping( Context ctx, String path, ServletWrapper servlet) throws TomcatException
{
  +    public void addMapping( Context ctx, String path, Handler servlet) throws TomcatException
{
   	ctx.log( "Add mapping " + path + "->" + servlet);
       }
   
  @@ -197,23 +197,23 @@
   
       /** Servlet Init  notification
        */
  -    public void preServletInit( Context ctx, ServletWrapper sw ) throws TomcatException
{
  +    public void preServletInit( Context ctx, Handler sw ) throws TomcatException {
   	ctx.log( "Pre servlet init " + sw);
       }
   
       
  -    public void postServletInit( Context ctx, ServletWrapper sw ) throws TomcatException
{
  +    public void postServletInit( Context ctx, Handler sw ) throws TomcatException {
   	ctx.log( "Post servlet init " + sw);
       }
   
       /** Servlet Destroy  notification
        */
  -    public void preServletDestroy( Context ctx, ServletWrapper sw ) throws TomcatException
{
  +    public void preServletDestroy( Context ctx, Handler sw ) throws TomcatException {
   	ctx.log( "Pre servlet destroy " + sw);
       }
   
       
  -    public void postServletDestroy( Context ctx, ServletWrapper sw ) throws TomcatException
{
  +    public void postServletDestroy( Context ctx, Handler sw ) throws TomcatException {
   	ctx.log( "Post servlet destroy " + sw);
       }
   
  
  
  
  1.29      +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/context/WebXmlReader.java
  
  Index: WebXmlReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/WebXmlReader.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- WebXmlReader.java	2000/07/11 03:48:41	1.28
  +++ WebXmlReader.java	2000/08/02 02:17:07	1.29
  @@ -179,7 +179,8 @@
   	    // Servlet
   	    xh.addRule("web-app/servlet", xh.objectCreate("org.apache.tomcat.core.ServletWrapper")
); // servlet-wrapper
   	    xh.addRule("web-app/servlet", xh.setParent( "setContext") ); // remove it from stack
when done
  -	    xh.addRule("web-app/servlet", xh.addChild("addServlet", null) ); // remove it from
stack when done
  +	    xh.addRule("web-app/servlet", xh.addChild("addServlet", "org.apache.tomcat.core.Handler")
);
  +	    // remove it from stack when done
   	    xh.addRule("web-app/servlet/servlet-name", xh.methodSetter("setServletName",0) );
   	    xh.addRule("web-app/servlet/servlet-class", xh.methodSetter("setServletClass",0));
   	    xh.addRule("web-app/servlet/jsp-file",xh.methodSetter("setPath",0));
  
  
  
  1.16      +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/core/BaseInterceptor.java
  
  Index: BaseInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BaseInterceptor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- BaseInterceptor.java	2000/07/11 02:33:46	1.15
  +++ BaseInterceptor.java	2000/08/02 02:17:09	1.16
  @@ -203,20 +203,20 @@
   
       /** Servlet Init  notification
        */
  -    public void preServletInit( Context ctx, ServletWrapper sw ) throws TomcatException
{
  +    public void preServletInit( Context ctx, Handler sw ) throws TomcatException {
       }
   
       
  -    public void postServletInit( Context ctx, ServletWrapper sw ) throws TomcatException
{
  +    public void postServletInit( Context ctx, Handler sw ) throws TomcatException {
       }
   
       /** Servlet Destroy  notification
        */
  -    public void preServletDestroy( Context ctx, ServletWrapper sw ) throws TomcatException
{
  +    public void preServletDestroy( Context ctx, Handler sw ) throws TomcatException {
       }
   
       
  -    public void postServletDestroy( Context ctx, ServletWrapper sw ) throws TomcatException
{
  +    public void postServletDestroy( Context ctx, Handler sw ) throws TomcatException {
       }
   
   }
  
  
  
  1.26      +3 -3      jakarta-tomcat/src/share/org/apache/tomcat/core/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Container.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Container.java	2000/07/25 20:17:42	1.25
  +++ Container.java	2000/08/02 02:17:09	1.26
  @@ -131,7 +131,7 @@
   
       /** The handler associated with this container.
        */
  -    ServletWrapper handler;
  +    Handler handler;
       
       /** Security constraints associated with this Container
        */
  @@ -270,13 +270,13 @@
       
       /** The handler for this container
        */
  -    public ServletWrapper getHandler() {
  +    public Handler getHandler() {
   	return handler;
       }
   
       /** The handler ( servlet ) for this container
        */
  -    public void setHandler(ServletWrapper h) {
  +    public void setHandler(Handler h) {
   	handler=h;
       }
   
  
  
  
  1.106     +33 -32    jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- Context.java	2000/07/28 17:21:33	1.105
  +++ Context.java	2000/08/02 02:17:09	1.106
  @@ -144,7 +144,7 @@
       Hashtable envEntryTypes=new Hashtable();
       Hashtable envEntryValues=new Hashtable();
   
  -    // Maps specified in web.xml ( String url -> ServletWrapper  )
  +    // Maps specified in web.xml ( String url -> Handler  )
       private Hashtable mappings = new Hashtable();
       Hashtable constraints=new Hashtable();
   
  @@ -153,7 +153,7 @@
       Container defaultContainer = null; // generalization, will replace most of the
       // functionality. By using a default container we avoid a lot of checkings
       // and speed up searching, and we can get rid of special properties.
  -    private ServletWrapper defaultServlet = null;
  +    private Handler defaultServlet = null;
   
       // Authentication properties
       String authMethod;
  @@ -527,12 +527,15 @@
   	    Container ct=(Container)containers.get( path );
   	    removeContainer( ct );
   	}
  -        ServletWrapper sw = (ServletWrapper)servlets.get(servletName);
  +        Handler sw = (Handler)servlets.get(servletName);
   	if (sw == null) {
  +	    // Strict web.xml
  +	    throw new TomcatException( "Mapping with invalid servlet name " +
  +				       path + " " + servletName );
   	    // Workaround for frequent "bug" in web.xmls
   	    // Declare a default mapping
  -	    log("Mapping with unregistered servlet " + servletName );
  -	    sw = addServlet( servletName, servletName );
  +	    // log("Mapping with unregistered servlet " + servletName );
  +	    // 	    sw = addServlet( servletName, servletName );
   	}
   	if( "/".equals(path) )
   	    defaultServlet = sw;
  @@ -598,7 +601,7 @@
   	containers.remove(ct.getPath());
       }
   
  -//     public ServletWrapper getDefaultServlet() {
  +//     public Handler getDefaultServlet() {
   // 	if( defaultServlet==null)
   // 	    defaultServlet=getServletByName(Constants.DEFAULT_SERVLET_NAME );
   // 	return defaultServlet;
  @@ -615,8 +618,8 @@
   	servlets.remove( servletName );
       }
   
  -    public ServletWrapper getServletByName(String servletName) {
  -	return (ServletWrapper)servlets.get(servletName);
  +    public Handler getServletByName(String servletName) {
  +	return (Handler)servlets.get(servletName);
       }
   
       /**
  @@ -626,11 +629,11 @@
        *
        * Called to add a new servlet from web.xml
        */
  -    public void addServlet(ServletWrapper wrapper)
  +    public void addServlet(Handler wrapper)
       	throws TomcatException
       {
   	wrapper.setContext( this );
  -	String name=wrapper.getServletName();
  +	String name=wrapper.getName();
   	//	log("Adding servlet " + name  + " " + wrapper);
   
           // check for duplicates
  @@ -642,21 +645,21 @@
   	servlets.put(name, wrapper);
       }
   
  -    public ServletWrapper addServlet(String name, String classN)
  -	throws TomcatException
  -    {
  -	ServletWrapper sw = new ServletWrapper();
  -	sw.setContext(this);
  +//     public Handler addServlet(String name, String classN)
  +// 	throws TomcatException
  +//     {
  +// 	Handler sw = new Handler();
  +// 	sw.setContext(this);
   	
  -	sw.setServletName(name);
  -	if ( classN.startsWith("/")) {
  -	    sw.setPath(classN);
  -	} else {
  -	    sw.setServletClass(classN);
  -	}
  -	addServlet( sw );
  -	return sw;
  -    }
  +// 	sw.setServletName(name);
  +// 	if ( classN.startsWith("/")) {
  +// 	    sw.setPath(classN);
  +// 	} else {
  +// 	    sw.setServletClass(classN);
  +// 	}
  +// 	addServlet( sw );
  +// 	return sw;
  +//     }
   
       public Enumeration getServletNames() {
   	return servlets.keys();
  @@ -701,14 +704,12 @@
   	Enumeration sE=servlets.elements();
   	while( sE.hasMoreElements() ) {
   	    try {
  -		ServletWrapper sw=(ServletWrapper)sE.nextElement();
  -		if( sw.getServletClassName() != null ) {
  -		    // this is dynamicaly added, probably a JSP.
  -		    // in any case, we can't save it
  -		    sw.reload();
  -		}
  -		// 		log( "Removing " + sw.getName());
  -		// 		removeServletByName( sw.getName());
  +		Handler sw=(Handler)sE.nextElement();
  +		// 		if( sw.getServletClassName() != null ) {
  +		// 		    // this is dynamicaly added, probably a JSP.
  +		// 		    // in any case, we can't save it
  +		sw.reload();
  +		//		}
   	    } catch( Exception ex ) {
   		log( "Reload exception: " + ex);
   	    }
  
  
  
  1.12      +7 -7      jakarta-tomcat/src/share/org/apache/tomcat/core/ContextInterceptor.java
  
  Index: ContextInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextInterceptor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ContextInterceptor.java	2000/06/15 19:34:27	1.11
  +++ ContextInterceptor.java	2000/08/02 02:17:10	1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextInterceptor.java,v
1.11 2000/06/15 19:34:27 jon Exp $
  - * $Revision: 1.11 $
  - * $Date: 2000/06/15 19:34:27 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextInterceptor.java,v
1.12 2000/08/02 02:17:10 costin Exp $
  + * $Revision: 1.12 $
  + * $Date: 2000/08/02 02:17:10 $
    *
    * ====================================================================
    *
  @@ -156,15 +156,15 @@
       /** Servlet Init notification.
        *  XXX do we need "pre/post" for init/destroy ? transactions? 
        */
  -    public void preServletInit( Context ctx, ServletWrapper sw ) throws TomcatException;
  +    public void preServletInit( Context ctx, Handler sw ) throws TomcatException;
       
  -    public void postServletInit( Context ctx, ServletWrapper sw ) throws TomcatException;
  +    public void postServletInit( Context ctx, Handler sw ) throws TomcatException;
   
   
       /** Servlet Destroy  notification
        */
  -    public void preServletDestroy( Context ctx, ServletWrapper sw ) throws TomcatException;
  +    public void preServletDestroy( Context ctx, Handler sw ) throws TomcatException;
       
  -    public void postServletDestroy( Context ctx, ServletWrapper sw ) throws TomcatException;
  +    public void postServletDestroy( Context ctx, Handler sw ) throws TomcatException;
   
   }
  
  
  
  1.108     +7 -8      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.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- ContextManager.java	2000/07/31 02:35:15	1.107
  +++ ContextManager.java	2000/08/02 02:17:10	1.108
  @@ -376,7 +376,7 @@
   	Enumeration enum = ctx.getServletNames();
   	while (enum.hasMoreElements()) {
   	    String key = (String)enum.nextElement();
  -	    ServletWrapper wrapper = ctx.getServletByName( key );
  +	    Handler wrapper = ctx.getServletByName( key );
   	    ctx.removeServletByName( key );
   	    try {
   		wrapper.destroy();
  @@ -675,7 +675,7 @@
   	}
       }
   
  -    /** Will find the ServletWrapper for a servlet, assuming we already have
  +    /** Will find the Handler for a servlet, assuming we already have
        *  the Context. This is also used by Dispatcher and getResource -
        *  where the Context is already known.
        */
  @@ -772,7 +772,6 @@
       {
   	if (!res.isBufferCommitted()) {
   	    res.endHeaders();
  -	    res.setBufferCommitted(true);
   	}
   	if( cnt>0 ) {
   	    doBeforeCommit( req, res );
  @@ -991,7 +990,7 @@
   	errorServlet.service( req, res );
       }
   
  -    public ServletWrapper getHandlerForPath( Context ctx, String path ) {
  +    public Handler getHandlerForPath( Context ctx, String path ) {
   	if( ! path.startsWith( "/" ) ) {
   	    return ctx.getServletByName( path );
   	}
  @@ -1296,7 +1295,7 @@
   	}
       }
   
  -    public void doPreServletInit(Context ctx, ServletWrapper sw)
  +    public void doPreServletInit(Context ctx, Handler sw)
   	throws TomcatException
       {
   	ContextInterceptor cI[]=getContextInterceptors();
  @@ -1309,7 +1308,7 @@
   	}
       }
   
  -    public void doPostServletInit(Context ctx, ServletWrapper sw)
  +    public void doPostServletInit(Context ctx, Handler sw)
   	throws TomcatException
       {
   	ContextInterceptor cI[]=getContextInterceptors();
  @@ -1322,7 +1321,7 @@
   	}
       }
   
  -    public void doPreServletDestroy(Context ctx, ServletWrapper sw)
  +    public void doPreServletDestroy(Context ctx, Handler sw)
   	throws TomcatException
       {
   	ContextInterceptor cI[]=getContextInterceptors();
  @@ -1335,7 +1334,7 @@
   	}
       }
   
  -    public void doPostServletDestroy(Context ctx, ServletWrapper sw)
  +    public void doPostServletDestroy(Context ctx, Handler sw)
   	throws TomcatException
       {
   	ContextInterceptor cI[]=getContextInterceptors();
  
  
  
  1.4       +2 -2      jakarta-tomcat/src/share/org/apache/tomcat/core/FacadeManager.java
  
  Index: FacadeManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/FacadeManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FacadeManager.java	2000/07/29 18:34:48	1.3
  +++ FacadeManager.java	2000/08/02 02:17:10	1.4
  @@ -75,7 +75,7 @@
   // the Context directly - same security checks.
   
   // For core use ( creation of Facade objects ) we can call directly.
  -// In fact, there is only one call ( in ServletWrapper ) and SW
  +// In fact, there is only one call ( in Handler ) and SW
   // belongs to Facade anyway - so it may not need this.
   // Removing it will also make things simpler.
   
  @@ -92,7 +92,7 @@
   
       public  HttpServletResponse createHttpServletResponseFacade(Response res);
   
  -    public ServletConfig createServletConfig(ServletWrapper sw);
  +    public ServletConfig createServletConfig(Handler sw);
   
       public  void recycle( Request req );
   
  
  
  
  1.9       +14 -7     jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Handler.java	2000/07/11 03:48:43	1.8
  +++ Handler.java	2000/08/02 02:17:11	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v 1.8
2000/07/11 03:48:43 alex Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/07/11 03:48:43 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v 1.9
2000/08/02 02:17:11 costin Exp $
  + * $Revision: 1.9 $
  + * $Date: 2000/08/02 02:17:11 $
    *
    * ====================================================================
    *
  @@ -129,6 +129,13 @@
   	return context;
       }
   
  +    public void reload() {
  +    }
  +
  +    public int getLoadOnStartUp() {
  +	return 0;
  +    }
  +    
       public boolean isInternal() {
   	return internal;
       }
  @@ -180,14 +187,14 @@
   	initialized=false;
   
   	if( ! internal )
  -	    contextM.doPreServletDestroy( context, (ServletWrapper)this);
  +	    contextM.doPreServletDestroy( context, this);
   	
   	// XXX post will not be called if any error happens in destroy.
   	// That's how tomcat worked before - I think it's a bug !
   	doDestroy();
   
   	if( ! internal )
  -	    contextM.doPostServletDestroy( context, (ServletWrapper)this);
  +	    contextM.doPostServletDestroy( context, this);
       }
   
       /** Initialize the handler. Handler can override this
  @@ -212,14 +219,14 @@
   	    }
   	    
   	    if( ! internal )
  -		contextM.doPreServletInit( context, (ServletWrapper)this);
  +		contextM.doPreServletInit( context, this);
   	    doInit();
   
   	    // if an exception is thrown in init, no end interceptors will
   	    // be called. that was in the origianl code J2EE used
   
   	    if( ! internal )
  -		contextM.doPostServletInit( context, (ServletWrapper)this);
  +		contextM.doPostServletInit( context, this);
   	    
   	} catch( Exception ex ) {
   	    initialized=false;
  
  
  
  1.49      +2 -2      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.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- Request.java	2000/07/31 02:35:15	1.48
  +++ Request.java	2000/08/02 02:17:11	1.49
  @@ -314,12 +314,12 @@
        *  Similar with "handler" in Apache.
        *  @deprecated - use Container instead
        */
  -    public ServletWrapper getWrapper() ;
  +    public Handler getWrapper() ;
   
       /**
        *  @deprecated - use Container instead
        */
  -    public void setWrapper(ServletWrapper handler) ;
  +    public void setWrapper(Handler handler) ;
   
       // -------------------- Included requests --------------------
       public static final int MAX_INCLUDE=10;
  
  
  
  1.56      +3 -3      jakarta-tomcat/src/share/org/apache/tomcat/core/RequestImpl.java
  
  Index: RequestImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestImpl.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- RequestImpl.java	2000/07/29 18:43:55	1.55
  +++ RequestImpl.java	2000/08/02 02:17:11	1.56
  @@ -141,7 +141,7 @@
       // LookupResult - used by sub-requests and
       // set by interceptors
       protected String servletName;
  -    protected ServletWrapper handler = null;
  +    protected Handler handler = null;
       Container container;
   
       protected String mappedPath = null;
  @@ -506,11 +506,11 @@
   	return cookieArray;
       }
       // -------------------- LookupResult
  -    public ServletWrapper getWrapper() {
  +    public Handler getWrapper() {
   	return handler;
       }
   
  -    public void setWrapper(ServletWrapper handler) {
  +    public void setWrapper(Handler handler) {
   	this.handler=handler;
       }
   
  
  
  
  1.24      +3 -0      jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Response.java	2000/07/31 02:35:15	1.23
  +++ Response.java	2000/08/02 02:17:12	1.24
  @@ -128,6 +128,9 @@
        */
       public ServletOutputStream getOutputStream() throws IOException;
   
  +    public void setServletOutputStream(ServletOutputStream s );
  +    public void setWriter( PrintWriter w );
  +    
       public void doWrite( byte buffer[], int pos, int count) throws IOException;
       
       public PrintWriter getWriter() throws IOException ;
  
  
  
  1.37      +42 -11    jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java
  
  Index: ResponseImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ResponseImpl.java	2000/07/31 02:35:15	1.36
  +++ ResponseImpl.java	2000/08/02 02:17:12	1.37
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v
1.36 2000/07/31 02:35:15 costin Exp $
  - * $Revision: 1.36 $
  - * $Date: 2000/07/31 02:35:15 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v
1.37 2000/08/02 02:17:12 costin Exp $
  + * $Revision: 1.37 $
  + * $Date: 2000/08/02 02:17:12 $
    *
    * ====================================================================
    *
  @@ -100,15 +100,23 @@
   
       protected MimeHeaders headers = new MimeHeaders();
   
  -    //    protected BufferedServletOutputStream out;
  +    // When getWriter is called on facade, both sos and writer are
  +    // set.
  +    // usingStream== ( sos!=null && writer ==null)
  +    // usingWriter== ( writer != null )
  +    // started == ( sos!=null )
  +    protected ServletOutputStream sos;
       protected PrintWriter writer;
  +
  +    protected boolean commited = false;
  +
       //    protected ByteBuffer bBuffer;
       protected OutputBuffer oBuffer;
   
  +    // @deprecated
       protected boolean usingStream = false;
       protected boolean usingWriter = false;
       protected boolean started = false;
  -    protected boolean commited = false;
       
       boolean notIncluded=true;
   
  @@ -188,6 +196,7 @@
   	usingStream = false;
   	sessionId=null;
   	writer=null;
  +	sos=null;
   	started = false;
   	commited = false;
   	notIncluded=true;
  @@ -243,16 +252,30 @@
   	//	if( out!=null ) out.setUsingWriter(true);
       }
   
  +    public void setWriter( PrintWriter w ) {
  +	this.writer=w;
  +    }
  +    
       public PrintWriter getWriter() throws IOException {
  +	// usingWriter
  +	if( writer != null )
  +	    return writer;
  +
  +	sos=getFacade().getOutputStream();
  +	    
  +	writer=getWriter( sos );
  +
  +	return writer;
  +   
   	// 	if( out !=null )
   	// 	    return getWriter( out );
   	
   	// it will know what to do. This method is here
   	// just to keep old code happy ( internal error handlers)
  -	if( usingStream ) {
  -	    return getWriter( getFacade().getOutputStream());
  -	}
  -	return getFacade().getWriter();
  +	//if( usingStream ) {
  +	//    return getWriter( getFacade().getOutputStream());
  +	//}
  +	//return getFacade().getWriter();
       }
   
       public PrintWriter getWriter(ServletOutputStream outs) throws IOException {
  @@ -304,10 +327,17 @@
       public ServletOutputStream getOutputStream() throws IOException {
   	started = true;
   // 	if( out!=null)
  -// 	    return out; 
  -	return getFacade().getOutputStream();
  +// 	    return out;
  +	// neither writer or output stream used
  +	if( sos == null )
  +	    sos=getFacade().getOutputStream();
  +
  +	return sos;
       }
   
  +    public void setServletOutputStream( ServletOutputStream s ) {
  +	sos=s;
  +    }
   
       // -------------------- Headers --------------------
       public MimeHeaders getMimeHeaders() {
  @@ -464,6 +494,7 @@
        *  interceptors to fix headers.
        */
       public void notifyEndHeaders() throws IOException {
  +	commited=true;
   	//	log("End headers " + request.getProtocol());
   	if(request.getProtocol()==null) // HTTP/0.9 
   	    return;
  
  
  
  1.67      +11 -3     jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java
  
  Index: ServletWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- ServletWrapper.java	2000/07/29 01:35:11	1.66
  +++ ServletWrapper.java	2000/08/02 02:17:12	1.67
  @@ -141,6 +141,10 @@
   	isReloadable = reloadable;
       }
   
  +    public String getName() {
  +	return getServletName();
  +    }
  +    
       public String getServletName() {
   	if(name!=null) return name;
   	return path;
  @@ -187,8 +191,12 @@
   		log( "Error in destroy ", ex );
   	    }
   	}
  -	servlet=null;
  -	servletClass=null;
  +
  +	if( servletClassName != null ) {
  +	    // I can survive reload
  +	    servlet=null;
  +	    servletClass=null;
  +	}
   	initialized=false;
       }
       
  @@ -389,7 +397,7 @@
   	// I don't think that ever worked anyway - and I don't think
   	// it can work without integrating Jsp handling into tomcat
   	// ( using interceptor )
  -	ServletWrapper jspServletW = context.getServletByName("jsp");
  +	ServletWrapper jspServletW = (ServletWrapper)context.getServletByName("jsp");
   	servletClassName = jspServletW.getServletClass();
       }
       
  
  
  
  1.11      +7 -3      jakarta-tomcat/src/share/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- HttpServletResponseFacade.java	2000/07/31 02:35:16	1.10
  +++ HttpServletResponseFacade.java	2000/08/02 02:17:25	1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
1.10 2000/07/31 02:35:16 costin Exp $
  - * $Revision: 1.10 $
  - * $Date: 2000/07/31 02:35:16 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
1.11 2000/08/02 02:17:25 costin Exp $
  + * $Revision: 1.11 $
  + * $Date: 2000/08/02 02:17:25 $
    *
    * ====================================================================
    *
  @@ -165,6 +165,7 @@
   	if( osFacade!=null) return osFacade;
   	//if( response.getOutputBuffer() != null ) {
   	osFacade=new ServletOutputStreamFacade(response);
  +	response.setServletOutputStream( osFacade );
   	//}
   	return osFacade;
   
  @@ -191,6 +192,9 @@
   	}
   
   	writer=((ResponseImpl)response).getWriter( osFacade );
  +	response.setServletOutputStream( osFacade );
  +	response.setWriter(  writer );
  +
   	return writer;
       }
   
  
  
  
  1.9       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/facade/RequestDispatcherImpl.java
  
  Index: RequestDispatcherImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/RequestDispatcherImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RequestDispatcherImpl.java	2000/06/30 20:21:33	1.8
  +++ RequestDispatcherImpl.java	2000/08/02 02:17:25	1.9
  @@ -187,7 +187,7 @@
   
   
   	// CM should have set the wrapper - call it
  -	ServletWrapper wr=realRequest.getWrapper();
  +	Handler wr=realRequest.getWrapper();
   	if( wr!=null ) wr.service(realRequest, realResponse);
   
   	// close the response - output after this point will be discarded.
  @@ -304,7 +304,7 @@
    	// now it's really strange: we call the wrapper on the subrequest
   	// for the realRequest ( since the real request will still have the
   	// original handler/wrapper )
  -	ServletWrapper wr=subRequest.getWrapper();
  +	Handler wr=subRequest.getWrapper();
   	if( wr!=null ) wr.service(realRequest, realResponse);
   
   	// After request, we want to restore the include attributes - for
  @@ -340,7 +340,7 @@
   	// Use the original request - as in specification !
   
   	// We got here if name!=null, so assert it
  -	ServletWrapper wrapper = context.getServletByName( name );
  +	Handler wrapper = context.getServletByName( name );
   	Request realR=((HttpServletRequestFacade)request).getRealRequest();
   	if( wrapper!=null)
   	    wrapper.service( realR, realR.getResponse());
  @@ -351,7 +351,7 @@
       public void forwardNamed(ServletRequest request, ServletResponse response)
   	throws ServletException, IOException
       {
  -	ServletWrapper wrapper = context.getServletByName( name );
  +	Handler wrapper = context.getServletByName( name );
   	Request realR=((HttpServletRequestFacade)request).getRealRequest();
   
   	if( wrapper!=null)
  
  
  
  1.4       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/facade/ServletContextFacade.java
  
  Index: ServletContextFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/ServletContextFacade.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServletContextFacade.java	2000/05/30 15:40:09	1.3
  +++ ServletContextFacade.java	2000/08/02 02:17:26	1.4
  @@ -165,7 +165,7 @@
   	    return null;
   
   	// We need to do the checks
  -	ServletWrapper wrapper = context.getServletByName( name );
  +	Handler wrapper = context.getServletByName( name );
   	if (wrapper == null)
   	    return null;
   	RequestDispatcherImpl rD=new RequestDispatcherImpl( context );
  
  
  
  1.5       +2 -2      jakarta-tomcat/src/share/org/apache/tomcat/facade/SimpleFacadeManager.java
  
  Index: SimpleFacadeManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/SimpleFacadeManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleFacadeManager.java	2000/07/11 03:48:47	1.4
  +++ SimpleFacadeManager.java	2000/08/02 02:17:26	1.5
  @@ -165,9 +165,9 @@
       }
   
   
  -    public ServletConfig createServletConfig(ServletWrapper sw) {
  +    public ServletConfig createServletConfig(Handler sw) {
   	//	if( sw.getContext() != ctx ) return null;
  -	return new ServletConfigImpl(sw);
  +	return new ServletConfigImpl((ServletWrapper)sw);
       }
   
   
  
  
  
  1.15      +3 -3      jakarta-tomcat/src/share/org/apache/tomcat/request/AccessInterceptor.java
  
  Index: AccessInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/AccessInterceptor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AccessInterceptor.java	2000/07/28 16:30:59	1.14
  +++ AccessInterceptor.java	2000/08/02 02:17:27	1.15
  @@ -326,7 +326,7 @@
       }
   }
   
  -class BasicAuthHandler extends ServletWrapper {
  +class BasicAuthHandler extends Handler {
       
       BasicAuthHandler() {
   	initialized=true;
  @@ -351,7 +351,7 @@
       XXX If we have user/pass, but still no permission  - display
       error page.
   */
  -class FormAuthHandler extends ServletWrapper {
  +class FormAuthHandler extends Handler {
       
       FormAuthHandler() {
   	initialized=true;
  @@ -408,7 +408,7 @@
   
       This is called after the user POST the form login page.
   */
  -class FormSecurityCheckHandler extends ServletWrapper {
  +class FormSecurityCheckHandler extends Handler {
       
       FormSecurityCheckHandler() {
   	initialized=true;
  
  
  
  1.6       +8 -3      jakarta-tomcat/src/share/org/apache/tomcat/request/InvokerInterceptor.java
  
  Index: InvokerInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/InvokerInterceptor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- InvokerInterceptor.java	2000/07/11 03:48:51	1.5
  +++ InvokerInterceptor.java	2000/08/02 02:17:27	1.6
  @@ -137,10 +137,10 @@
   		 " SP=" + newServletPath +
   		 " PI=" + newPathInfo);
   	
  -	ServletWrapper wrapper = ctx.getServletByName(servletName);
    	req.setServletPath(newServletPath);
   	req.setPathInfo(newPathInfo);
   	
  +	Handler wrapper = ctx.getServletByName(servletName);
   	if (wrapper != null) {
   	    req.setWrapper( wrapper );
   	    return 0;
  @@ -153,10 +153,15 @@
   	// it's a much cleaner way to construct the servlet and
   	// make sure all interceptors are up to date.
   	try {
  -	    wrapper = ctx.addServlet( servletName, servletName );
  +	    ServletWrapper sw=new ServletWrapper();
  +	    sw.setContext(ctx);
  +	    sw.setServletName(servletName);
  +	    sw.setServletClass( servletName );
  +	    sw.setOrigin( Handler.ORIGIN_INVOKER );
  +	    wrapper=sw;
  +	    ctx.addServlet( sw );
   	    ctx.addServletMapping( newServletPath + "/*" ,
   				   servletName );
  -	    wrapper.setOrigin( ServletWrapper.ORIGIN_INVOKER );
   	    if( debug > 0)
   		log( "Added mapping " + wrapper +
   		     " path=" + newServletPath + "/*" );
  
  
  
  1.11      +3 -3      jakarta-tomcat/src/share/org/apache/tomcat/request/Jdk12Interceptor.java
  
  Index: Jdk12Interceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/Jdk12Interceptor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Jdk12Interceptor.java	2000/07/27 18:47:47	1.10
  +++ Jdk12Interceptor.java	2000/08/02 02:17:27	1.11
  @@ -84,7 +84,7 @@
   	debug=i;
       }
   
  -    public void preServletInit( Context ctx, ServletWrapper sw )
  +    public void preServletInit( Context ctx, Handler sw )
   	throws TomcatException
       {
   	fixJDKContextClassLoader(ctx);
  @@ -92,13 +92,13 @@
   
       /** Servlet Destroy  notification
        */
  -    public void preServletDestroy( Context ctx, ServletWrapper sw )
  +    public void preServletDestroy( Context ctx, Handler sw )
   	throws TomcatException
       {
   	fixJDKContextClassLoader(ctx);
       }
       
  -    public void postServletInit( Context ctx, ServletWrapper sw )
  +    public void postServletInit( Context ctx, Handler sw )
   	throws TomcatException
       {
   	// no need to change the cl - next requst will do that
  
  
  
  1.6       +10 -7     jakarta-tomcat/src/share/org/apache/tomcat/request/JspInterceptor.java
  
  Index: JspInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/JspInterceptor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JspInterceptor.java	2000/07/27 18:47:47	1.5
  +++ JspInterceptor.java	2000/08/02 02:17:27	1.6
  @@ -101,10 +101,10 @@
   	}
       }
   
  -    public void preServletInit( Context ctx, ServletWrapper sw )
  +    public void preServletInit( Context ctx, Handler sw )
   	throws TomcatException
       {
  -	Servlet theServlet = sw.getServlet();
  +	Servlet theServlet = ((ServletWrapper)sw).getServlet();
   	if (theServlet instanceof HttpJspBase)  {
   	    if( debug > 0 )
   		log( "PreServletInit: HttpJspBase.setParentClassLoader" + sw );
  @@ -114,7 +114,7 @@
       }
   
       public int requestMap( Request req ) {
  -	ServletWrapper wrapper=req.getWrapper();
  +	ServletWrapper wrapper=(ServletWrapper)req.getWrapper();
   	if( wrapper!=null && ! "jsp".equals( wrapper.getName())
   	    && wrapper.getPath() == null)
   	    return 0;
  @@ -161,13 +161,16 @@
   	// The memory usage is smaller than JspSerlvet anyway, but
   	// can be further improved.
   	try {
  -	    wrapper=ctx.getServletByName( servletName );
  +	    wrapper=(ServletWrapper)ctx.getServletByName( servletName );
   	    // We may want to replace the class and reset it if changed
   	    
   	    if( wrapper==null ) {
  -		wrapper=ctx.addServlet( servletName, classN );
  -		wrapper.setPath( servletName );
  -		wrapper.setOrigin( ServletWrapper.ORIGIN_INVOKER );
  +		wrapper=new ServletWrapper();
  +		wrapper.setContext(ctx);
  +		wrapper.setServletName(servletName);
  +		wrapper.setPath(classN);
  +		wrapper.setOrigin( Handler.ORIGIN_INVOKER );
  +		ctx.addServlet( wrapper );
   		
   		ctx.addServletMapping( servletPath ,
   				       servletPath );
  
  
  
  1.11      +2 -2      jakarta-tomcat/src/share/org/apache/tomcat/request/StaticInterceptor.java
  
  Index: StaticInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/StaticInterceptor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StaticInterceptor.java	2000/07/25 01:54:03	1.10
  +++ StaticInterceptor.java	2000/08/02 02:17:27	1.11
  @@ -215,7 +215,7 @@
   /** Serve the content of a file ( and nothing more !).
    *
    */
  -class FileHandler extends ServletWrapper  {
  +class FileHandler extends Handler  {
       int realFileNote;
       
       FileHandler() {
  @@ -339,7 +339,7 @@
   /** HTML-display for directories ( and nothing more !).
    *  This is the handler for static resources of type "dir".
    */
  -class DirHandler extends ServletWrapper  {
  +class DirHandler extends Handler  {
       private static final String datePattern = "EEE, dd MMM yyyyy HH:mm z";
       int realFileNote;
       
  
  
  
  1.6       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/session/SessionSerializer.java
  
  Index: SessionSerializer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/SessionSerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SessionSerializer.java	2000/06/23 02:16:25	1.5
  +++ SessionSerializer.java	2000/08/02 02:17:30	1.6
  @@ -70,7 +70,7 @@
   	HttpSessions hashtable from the SessionManager and then using a
   	special internal class ObjectInputStream that uses the newly created
   	classloader to de-serialize the sessions. This class is called from
  -	within the ServletWrapper.handleReload() method. Much of this code
  +	within the Handler.handleReload() method. Much of this code
   	is essentially the same as what I put into the Apache JServ release
   	so it is pretty well tested. It also depends on having HttpSession
   	implement the read/writeObject methods properly to only accept 
  
  
  

Mime
View raw message