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/util/xml XmlMapper.java
Date Wed, 22 Nov 2000 01:10:31 GMT
costin      00/11/21 17:10:31

  Modified:    src/etc  server.xml
               src/share/org/apache/tomcat/helper ServerXmlHelper.java
               src/share/org/apache/tomcat/startup EmbededTomcat.java
               src/share/org/apache/tomcat/util/xml XmlMapper.java
  Log:
  Fixed EmbededTomcat ( use the new session interceptors ).
  
  Small change in server.xml handling - allow "shortcuts" in connector
  names ( yes, it's a bit slower, but it's only at startup and it's not
  visible - 4 Class.forName instead of 1 is nothing compared with the
  rest of the startup tasks ).
  
  Revision  Changes    Path
  1.52      +3 -5      jakarta-tomcat/src/etc/server.xml
  
  Index: server.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/etc/server.xml,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- server.xml	2000/11/21 00:31:11	1.51
  +++ server.xml	2000/11/22 01:10:29	1.52
  @@ -99,7 +99,7 @@
   
         <!-- ==================== Interceptors ==================== -->
           <ContextInterceptor 
  -            className="org.apache.tomcat.context.DefaultCMSetter" />
  +            className="org.apache.tomcat.context.DefaultCMSetter" >
   
           <!-- 
            ContextInterceptor className="org.apache.tomcat.context.LogEvents" 
  @@ -137,8 +137,7 @@
           <!-- Session interceptor will extract the session id from cookies and 
                deal with URL rewriting ( by fixing the URL )
             -->
  -        <RequestInterceptor 
  -            className="org.apache.tomcat.modules.session.SessionId" />
  +        <RequestInterceptor className="SessionId" />
   
           <!-- Find the container ( context and prefix/extension map ) 
                for a request.
  @@ -180,8 +179,7 @@
           <!-- Plug a session manager. You can plug in more advanced session
                modules.
             -->
  -        <RequestInterceptor 
  -            className="org.apache.tomcat.modules.session.SimpleSessionStore" />
  +        <RequestInterceptor className="SimpleSessionStore" />
   
           <!-- Check if the request requires an authenticated role.
             -->
  
  
  
  1.8       +15 -5     jakarta-tomcat/src/share/org/apache/tomcat/helper/ServerXmlHelper.java
  
  Index: ServerXmlHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/helper/ServerXmlHelper.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ServerXmlHelper.java	2000/11/02 21:44:38	1.7
  +++ ServerXmlHelper.java	2000/11/22 01:10:30	1.8
  @@ -80,6 +80,16 @@
       private static StringManager sm =
   	StringManager.getManager("org.apache.tomcat.resources");
   
  +    public static final String[] MODULE_PKGS={
  +	"org.apache.tomcat.modules.session.",
  +	"org.apache.tomcat.modules.server.",
  +	"org.apache.tomcat.modules.config.",
  +	"org.apache.tomcat.modules.security.",
  +	"org.apache.tomcat.request.", // OLD
  +	"org.apache.tomcat.context." // OLD
  +    };
  +       
  +    
       public ServerXmlHelper() {
       }
   
  @@ -94,7 +104,7 @@
   
       public static void setInterceptorRules( XmlMapper xh ) {
   	xh.addRule( "ContextManager/ContextInterceptor",
  -		    xh.objectCreate(null, "className"));
  +		    xh.objectCreate(null, "className", MODULE_PKGS));
   	xh.addRule( "ContextManager/ContextInterceptor",
   		    xh.setProperties() );
   	xh.addRule( "ContextManager/ContextInterceptor",
  @@ -104,7 +114,7 @@
   				 "org.apache.tomcat.core.BaseInterceptor"));
   
   	xh.addRule( "ContextManager/RequestInterceptor",
  -		    xh.objectCreate(null, "className"));
  +		    xh.objectCreate(null, "className", MODULE_PKGS));
   	xh.addRule( "ContextManager/RequestInterceptor",
   		    xh.setProperties() );
   	xh.addRule( "ContextManager/RequestInterceptor",
  @@ -139,7 +149,7 @@
   	
   	// Configure context interceptors
   	xh.addRule( "Context/Interceptor",
  -		    xh.objectCreate(null, "className"));
  +		    xh.objectCreate(null, "className", MODULE_PKGS));
   	xh.addRule( "Context/Interceptor",
   		    xh.setProperties() );
   	xh.addRule( "Context/Interceptor",
  @@ -149,7 +159,7 @@
   				 "org.apache.tomcat.core.BaseInterceptor"));
   	// Old style 
   	xh.addRule( "Context/RequestInterceptor",
  -		    xh.objectCreate(null, "className"));
  +		    xh.objectCreate(null, "className", MODULE_PKGS));
   	xh.addRule( "Context/RequestInterceptor",
   		    xh.setProperties() );
   	xh.addRule( "Context/RequestInterceptor",
  @@ -167,7 +177,7 @@
   
       public void setConnectorHelper( XmlMapper xh ) {
   	xh.addRule( "ContextManager/Connector",
  -		    xh.objectCreate(null, "className"));
  +		    xh.objectCreate(null, "className", MODULE_PKGS));
   	xh.addRule( "ContextManager/Connector",
   		    xh.setParent( "setContextManager",
   				  "org.apache.tomcat.core.ContextManager") );
  
  
  
  1.31      +3 -3      jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java
  
  Index: EmbededTomcat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- EmbededTomcat.java	2000/11/02 21:45:05	1.30
  +++ EmbededTomcat.java	2000/11/22 01:10:30	1.31
  @@ -6,7 +6,7 @@
   import org.apache.tomcat.core.*;
   import org.apache.tomcat.request.*;
   import org.apache.tomcat.modules.server.*;
  -import org.apache.tomcat.session.StandardSessionInterceptor;
  +import org.apache.tomcat.modules.session.*;
   import org.apache.tomcat.context.*;
   import org.apache.tomcat.util.log.*;
   import java.security.*;
  @@ -360,7 +360,7 @@
   	// 	LogEvents logEventsI=new LogEvents();
   	// 	addRequestInterceptor( logEventsI );
   
  -	SessionInterceptor sessI=new SessionInterceptor();
  +	SessionId sessI=new SessionId();
   	addInterceptor( sessI );
   
   	SimpleMapper1 mapI=new SimpleMapper1();
  @@ -375,7 +375,7 @@
   	addInterceptor( staticI );
   	mapI.setDebug(0);
   
  -	addInterceptor( new StandardSessionInterceptor());
  +	addInterceptor( new SimpleSessionStore());
   	
   	// access control ( find if a resource have constraints )
   	AccessInterceptor accessI=new AccessInterceptor();
  
  
  
  1.29      +33 -1     jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java
  
  Index: XmlMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- XmlMapper.java	2000/11/01 21:39:35	1.28
  +++ XmlMapper.java	2000/11/22 01:10:30	1.29
  @@ -515,6 +515,15 @@
   	return new ObjectCreate( classN, attrib);
       }
   
  +    /** Create an object using an attribute value as the class name
  +	If no attribute use classN as a default. If the class name
  +	has no ".", use the third parameter as prefix
  +     */
  +    public XmlAction objectCreate( String classN, String attrib,String pref[])
  +    {
  +	return new ObjectCreate( classN, attrib, pref);
  +    }
  +
       /** Set object properties using XML attributes
        */
       public XmlAction setProperties(  ) {
  @@ -594,6 +603,7 @@
   class ObjectCreate extends XmlAction {
       String className;
       String attrib;
  +    String pref[]=null;
   
       /**
        * Create an object of the specified class name.
  @@ -619,6 +629,13 @@
   	this.attrib=attrib;
       }
   
  +    public ObjectCreate(String classN, String attrib, String pref[]) {
  +	className=classN;
  +	this.attrib=attrib;
  +	this.pref=pref;
  +    }
  +
  +    
       public void start( SaxContext ctx) throws Exception {
   	String tag=ctx.getCurrentElement();
   	String classN=className;
  @@ -627,8 +644,23 @@
   	    AttributeList attributes = ctx.getCurrentAttributes();
   	    if (attributes.getValue(attrib) != null)
   		classN= attributes.getValue(attrib);
  +	}
  +	Class c=null;
  +	if( pref!=null && classN.indexOf( "." ) <0 ) {
  +	    for( int i=0; i<pref.length; i++ ) {
  +		try {
  +		    c=Class.forName( pref[i] + classN );
  +		    if( c!=null ) break;
  +		} catch( Exception ex ) {
  +		    if( ctx.getDebug() > 0 )
  +			ctx.log( "Try " + pref[i] + classN );
  +		    // ignore
  +		}
  +	    }
  +	}
  +	if( c==null ) {
  +	    c=Class.forName( classN );
   	}
  -	Class c=Class.forName( classN );
   	Object o=c.newInstance();
   	ctx.pushObject(o);
   	if( ctx.getDebug() > 0 )
  
  
  

Mime
View raw message