You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by na...@locus.apache.org on 2000/08/16 00:10:07 UTC

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

nacho       00/08/15 15:10:07

  Modified:    src/share/org/apache/tomcat/core ContextManager.java
                        Context.java Container.java
  Log:
  Some cleanup, related to per Context RequestInterceptors:
  
  * ReAdded addRequestInterceptor in Context deleted
  by excess of cleanup :-)  this is need for xmlmapper
  
  * Translated code from GetRequestIntercepros(Request)
  ContextManager to Container.
  
  Revision  Changes    Path
  1.116     +1 -28     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.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- ContextManager.java	2000/08/14 17:49:12	1.115
  +++ ContextManager.java	2000/08/15 22:10:06	1.116
  @@ -61,7 +61,6 @@
   package org.apache.tomcat.core;
   
   import org.apache.tomcat.core.*;
  -import org.apache.tomcat.net.*;
   import org.apache.tomcat.context.*;
   import org.apache.tomcat.loader.*;
   import org.apache.tomcat.request.*;
  @@ -512,11 +511,6 @@
       }
   
       public void addRequestInterceptor( RequestInterceptor ri ) {
  -//	if(debug>0) log("Add requestInterceptor javaClass=\"" +
  -//			   ri.getClass().getName() + "\" ");
  -//	requestInterceptors.addElement( ri );
  -//	if( ri instanceof ContextInterceptor )
  -//	    contextInterceptors.addElement( ri );
           defaultContainer.addRequestInterceptor(ri);
       }
   
  @@ -532,28 +526,7 @@
   	Dynamic add of interceptors is not supported.
       */
       public RequestInterceptor[] getRequestInterceptors( Request req ) {
  -        Container ct=req.getContext().getContainer();
  -        RequestInterceptor[] cri=ct.getRequestInterceptors();
  -        RequestInterceptor[] ari=ct.getCachedInterceptors();
  -        if (ari.length == 0){
  -            RequestInterceptor[] gri=getRequestInterceptors();
  -            if  (cri!=null && cri.length > 0) {
  -                int al=cri.length+gri.length;
  -                ari=new RequestInterceptor[al];
  -                int i;
  -                for ( i = 0 ; i < gri.length ; i++ ){
  -                    ari[i]=gri[i];
  -                }
  -                for (int j = 0 ; j < cri.length ; j++ ){
  -                    ari[i+j]=cri[j];
  -                }
  -            } else {
  -                ari=gri;
  -            }
  -            ct.setCachedInterceptors(ari);
  -        }
  -
  -	return ari;
  +        return defaultContainer.getRequestInterceptors( req );
       }
   
       /** Return the context interceptors as an array.
  
  
  
  1.110     +4 -0      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.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- Context.java	2000/08/14 18:40:30	1.109
  +++ Context.java	2000/08/15 22:10:06	1.110
  @@ -1024,4 +1024,8 @@
   	log( "Illegal access to internal attribute ", null, Logger.ERROR);
   	return false;
       }
  +
  +    public void addRequestInterceptor( RequestInterceptor ri ) {
  +        defaultContainer.addRequestInterceptor(ri);
  +    }
   }
  
  
  
  1.28      +24 -0     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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Container.java	2000/08/13 02:04:12	1.27
  +++ Container.java	2000/08/15 22:10:06	1.28
  @@ -427,5 +427,29 @@
           rCachedInterceptors = newRCachedInterceptors;
       }
   
  +    public RequestInterceptor[] getRequestInterceptors( Request req ) {
  +        Container ct=req.getContext().getContainer();
  +        RequestInterceptor[] ari=ct.getCachedInterceptors();
  +        if (ari.length == 0){
  +            RequestInterceptor[] cri=ct.getRequestInterceptors();
  +            RequestInterceptor[] gri=getRequestInterceptors();
  +            if  (cri!=null && cri.length > 0) {
  +                int al=cri.length+gri.length;
  +                ari=new RequestInterceptor[al];
  +                int i;
  +                for ( i = 0 ; i < gri.length ; i++ ){
  +                    ari[i]=gri[i];
  +                }
  +                for (int j = 0 ; j < cri.length ; j++ ){
  +                    ari[i+j]=cri[j];
  +                }
  +            } else {
  +                ari=gri;
  +            }
  +            ct.setCachedInterceptors(ari);
  +        }
  +
  +	return ari;
  +    }
   
   }