tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup ContextConfig.java
Date Thu, 14 Sep 2000 00:14:58 GMT
craigmcc    00/09/13 17:14:58

  Modified:    catalina/src/share/org/apache/catalina Context.java
               catalina/src/share/org/apache/catalina/core
                        StandardContext.java
               catalina/src/share/org/apache/catalina/loader
                        StandardLoader.java
               catalina/src/share/org/apache/catalina/startup
                        ContextConfig.java
  Log:
  Allow the specification of a parent class loader on a per-Context basis.
  This class loader will become the parent of the web-app class loader that
  is created when its Context is started.  By default, the current behavior
  (parent of a webapp class loader is the system class loader) remains.
  
  NOTE:  This feature is only useful if you are embedding Catalina and starting
  it with a mechanism like the org.apache.catalina.startup.Embedded class.
  
  Revision  Changes    Path
  1.5       +24 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Context.java	2000/08/20 02:56:50	1.4
  +++ Context.java	2000/09/14 00:14:55	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
1.4 2000/08/20 02:56:50 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/08/20 02:56:50 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
1.5 2000/09/14 00:14:55 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/09/14 00:14:55 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * <p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/08/20 02:56:50 $
  + * @version $Revision: 1.5 $ $Date: 2000/09/14 00:14:55 $
    */
   
   public interface Context extends Container {
  @@ -193,6 +193,26 @@
        * @param config The new login configuration
        */
       public void setLoginConfig(LoginConfig config);
  +
  +
  +    /**
  +     * Return the parent class loader (if any) for this web application.
  +     * This call is meaningful only <strong>after</strong> a Loader has
  +     * been configured.
  +     */
  +    public ClassLoader getParentClassLoader();
  +
  +
  +    /**
  +     * Set the parent class loader (if any) for this web application.
  +     * This call is meaningful only <strong>before</strong> a Loader has
  +     * been configured, and the specified value (if non-null) should be
  +     * passed as an argument to the class loader constructor.
  +     *
  +     *
  +     * @param parent The new parent class loader
  +     */
  +    public void setParentClassLoader(ClassLoader parent);
   
   
       /**
  
  
  
  1.13      +38 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StandardContext.java	2000/09/08 03:36:24	1.12
  +++ StandardContext.java	2000/09/14 00:14:56	1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.12 2000/09/08 03:36:24 craigmcc Exp $
  - * $Revision: 1.12 $
  - * $Date: 2000/09/08 03:36:24 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.13 2000/09/14 00:14:56 craigmcc Exp $
  + * $Revision: 1.13 $
  + * $Date: 2000/09/14 00:14:56 $
    *
    * ====================================================================
    *
  @@ -104,7 +104,7 @@
    * requests directed to a particular servlet.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.12 $ $Date: 2000/09/08 03:36:24 $
  + * @version $Revision: 1.13 $ $Date: 2000/09/14 00:14:56 $
    */
   
   public final class StandardContext
  @@ -254,6 +254,12 @@
   
   
       /**
  +     * The parent class loader to be configured when we install a Loader.
  +     */
  +    private ClassLoader parentClassLoader = null;
  +
  +
  +    /**
        * The request processing pause flag (while reloading occurs)
        */
       private boolean paused = false;
  @@ -498,6 +504,34 @@
   	this.loginConfig = config;
   	support.firePropertyChange("loginConfig",
   				   oldLoginConfig, this.loginConfig);
  +
  +    }
  +
  +
  +    /**
  +     * Return the parent class loader (if any) for this web application.
  +     * This call is meaningful only <strong>after</strong> a Loader has
  +     * been configured.
  +     */
  +    public ClassLoader getParentClassLoader() {
  +
  +        return (this.parentClassLoader);
  +
  +    }
  +
  +
  +    /**
  +     * Set the parent class loader (if any) for this web application.
  +     * This call is meaningful only <strong>before</strong> a Loader has
  +     * been configured, and the specified value (if non-null) should be
  +     * passed as an argument to the class loader constructor.
  +     *
  +     *
  +     * @param parent The new parent class loader
  +     */
  +    public void setParentClassLoader(ClassLoader parent) {
  +
  +        this.parentClassLoader = parent;
   
       }
   
  
  
  
  1.3       +45 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java
  
  Index: StandardLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardLoader.java	2000/08/24 23:57:02	1.2
  +++ StandardLoader.java	2000/09/14 00:14:57	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
1.2 2000/08/24 23:57:02 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/08/24 23:57:02 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
1.3 2000/09/14 00:14:57 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/09/14 00:14:57 $
    *
    * ====================================================================
    *
  @@ -97,13 +97,42 @@
    * is not present, the system class loader will be used instead.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/08/24 23:57:02 $
  + * @version $Revision: 1.3 $ $Date: 2000/09/14 00:14:57 $
    */
   
   public final class StandardLoader
       implements Lifecycle, Loader, PropertyChangeListener, Runnable {
   
   
  +    // ----------------------------------------------------------- Constructors
  +
  +
  +    /**
  +     * Construct a new StandardLoader with no defined parent class loader
  +     * (so that the actual parent will be the system class loader).
  +     */
  +    public StandardLoader() {
  +
  +        this(null);
  +
  +    }
  +
  +
  +    /**
  +     * Construct a new StandardLoader with the specified class loader
  +     * to be defined as the parent of the ClassLoader we ultimately create.
  +     *
  +     * @param parent The parent class loader
  +     */
  +    public StandardLoader(ClassLoader parent) {
  +
  +
  +        super();
  +	this.parentClassLoader = parent;
  +
  +    }
  +
  +
       // ----------------------------------------------------- Instance Variables
   
   
  @@ -155,6 +184,12 @@
   
   
       /**
  +     * The parent class loader of the class loader we will create.
  +     */
  +    private ClassLoader parentClassLoader = null;
  +
  +
  +    /**
        * The reloadable flag for this Loader.
        */
       private boolean reloadable = false;
  @@ -534,8 +569,14 @@
   
   	// Construct a class loader based on our current repositories list
   	try {
  +            /*
   	    Class clazz = Class.forName(loaderClass);
   	    classLoader = (Reloader) clazz.newInstance();
  +	    */
  +	    if (parentClassLoader == null)
  +	        classLoader = new FileClassLoader();
  +	    else
  +	        classLoader = new FileClassLoader(parentClassLoader);
   	    for (int i = 0; i < repositories.length; i++)
   		classLoader.addRepository(repositories[i]);
   	    classLoader.addRestricted("org.apache.catalina.");
  
  
  
  1.12      +6 -5      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ContextConfig.java	2000/09/09 03:20:52	1.11
  +++ ContextConfig.java	2000/09/14 00:14:57	1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
1.11 2000/09/09 03:20:52 craigmcc Exp $
  - * $Revision: 1.11 $
  - * $Date: 2000/09/09 03:20:52 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
1.12 2000/09/14 00:14:57 craigmcc Exp $
  + * $Revision: 1.12 $
  + * $Date: 2000/09/14 00:14:57 $
    *
    * ====================================================================
    *
  @@ -109,7 +109,7 @@
    * of that Context, and the associated defined servlets.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.11 $ $Date: 2000/09/09 03:20:52 $
  + * @version $Revision: 1.12 $ $Date: 2000/09/14 00:14:57 $
    */
   
   public final class ContextConfig
  @@ -825,7 +825,8 @@
   	if (context.getLoader() == null) {
   	    if (debug > 0)
   		log(sm.getString("contextConfig.defaultLoader"));
  -	    context.setLoader(new StandardLoader());
  +	    context.setLoader
  +	      (new StandardLoader(context.getParentClassLoader()));
   	}
   
   	// Add missing Manager component if necessary
  
  
  

Mime
View raw message