You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/06/09 05:20:52 UTC

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

costin      01/06/08 20:20:52

  Modified:    src/share/org/apache/tomcat/core Context.java
                        ContextManager.java
  Log:
  Extra checks for errors on adding the modules.
  
  Added fields and accessors for the other 3 class loaders used in tomcat,
  to allow modules to start using it.
  
  Revision  Changes    Path
  1.142     +16 -10    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.141
  retrieving revision 1.142
  diff -u -r1.141 -r1.142
  --- Context.java	2001/03/02 04:49:06	1.141
  +++ Context.java	2001/06/09 03:20:51	1.142
  @@ -484,17 +484,23 @@
   	    for( int i=0; i< cI.length; i++ ) {
   		if( cI[i].getContext() != this )
   		    continue; // not ours, don't have to initialize it.
  -		cI[i].addInterceptor( contextM, this , cI[i] ); 
  -		BaseInterceptor existingI[]=defaultContainer.getInterceptors();
  -		for( int j=0; j<existingI.length; j++ ) {
  -		    if( existingI[j] != cI[i] )
  -			existingI[j].addInterceptor( contextM, this, cI[i] );
  +		try {
  +		    cI[i].addInterceptor( contextM, this , cI[i] ); 
  +		    BaseInterceptor existingI[]=defaultContainer.
  +			getInterceptors();
  +		    for( int j=0; j<existingI.length; j++ ) {
  +			if( existingI[j] != cI[i] )
  +			    existingI[j].addInterceptor( contextM,
  +							 this, cI[i] );
  +		    }
  +		    
  +		    // set all local interceptors 
  +		    cI[i].setContextManager( contextM );
  +		    cI[i].engineInit( contextM );
  +		    cI[i].addContext( contextM, this );
  +		} catch( TomcatException ex ) {
  +		    log("Error adding module " + cI[i] + " to " + this , ex);
   		}
  -		
  -		// set all local interceptors 
  -		cI[i].setContextManager( contextM );
  -		cI[i].engineInit( contextM );
  -		cI[i].addContext( contextM, this );
   	    }
   	}
   	this.state=state;
  
  
  
  1.180     +39 -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.179
  retrieving revision 1.180
  diff -u -r1.179 -r1.180
  --- ContextManager.java	2001/05/26 17:45:44	1.179
  +++ ContextManager.java	2001/06/09 03:20:52	1.180
  @@ -213,6 +213,15 @@
       // the embedding application loader. @see getParentLoader
       private ClassLoader parentLoader;
   
  +    // the common class loader, shared by container and apps
  +    private ClassLoader commonLoader;
  +
  +    // the container class loader, used to load all container modules
  +    private ClassLoader containerLoader;
  +
  +    // the webapp loader, with classes shared by all webapps.
  +    private ClassLoader appsLoader;
  +
       private Hashtable properties=new Hashtable();
       
       /**
  @@ -362,6 +371,30 @@
   	return parentLoader;
       }
   
  +    public final void setCommonLoader( ClassLoader cl ) {
  +	commonLoader=cl;
  +    }
  +
  +    public final ClassLoader getCommonLoader() {
  +	return commonLoader;
  +    }
  +
  +    public final void setContainerLoader( ClassLoader cl ) {
  +	containerLoader=cl;
  +    }
  +
  +    public final ClassLoader getContainerLoader() {
  +	return containerLoader;
  +    }
  +
  +    public final void setAppsLoader( ClassLoader cl ) {
  +	appsLoader=cl;
  +    }
  +
  +    public final ClassLoader getAppsLoader() {
  +	return appsLoader;
  +    }
  +
       /** Default container. The interceptors for this container will
   	be called for all requests, and it will be associated with
   	invalid requests ( where context can't be found ).
  @@ -518,6 +551,12 @@
   		for( int i=0; i<existingI.length; i++ ) {
   		    existingI[i].addContext( this, ctx );
   		}
  +	    } catch( TomcatException ex ) {
  +		log( "Error adding context " + ctx , ex );
  +		continue; 
  +	    }
  +	    try {
  +		// set state may throw exception
   		ctx.setState( Context.STATE_ADDED );
   		log("Adding  " +  ctx.toString());
   	    } catch( TomcatException ex ) {