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

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Bootstrap.java Catalina.java ContextConfig.java

remm        01/01/22 21:05:52

  Modified:    catalina/src/conf server.xml
               catalina/src/share/org/apache/catalina Container.java
               catalina/src/share/org/apache/catalina/core
                        ApplicationContext.java ContainerBase.java
                        StandardContext.java StandardHost.java
               catalina/src/share/org/apache/catalina/loader
                        StandardClassLoader.java StandardLoader.java
               catalina/src/share/org/apache/catalina/startup
                        Bootstrap.java Catalina.java ContextConfig.java
  Removed:     catalina/src/share/org/apache/catalina Resources.java
               catalina/src/share/org/apache/catalina/resources
                        Constants.java DirectoryBean.java
                        FileResources.java JarResources.java
                        LocalStrings.properties LocalStrings_es.properties
                        ResourceBean.java ResourcesBase.java package.html
  Log:
  - Complete the backport from 4.1.
  - Note : I noticed while merging that I had forgotten to update the TLD
    loading in ContextConfig (right now, it will only work from the filesystem; I've
    added that on my TODO list.
  
  Revision  Changes    Path
  1.17      +5 -3      jakarta-tomcat-4.0/catalina/src/conf/server.xml
  
  Index: server.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/server.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- server.xml	2000/12/17 01:03:29	1.16
  +++ server.xml	2001/01/23 05:05:41	1.17
  @@ -45,7 +45,9 @@
       <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
       <Connector className="org.apache.catalina.connector.http.HttpConnector"
                  port="8080" minProcessors="5" maxProcessors="75"
  -               acceptCount="10" debug="0"/>
  +               acceptCount="10" debug="0" connectionTimeout="60000"/>
  +    <!-- Note : To disable connection timeouts, set connectionTimeout value 
  +     to -1 -->
   
       <!-- Define an SSL HTTP/1.1 Connector on port 8443 -->
       <!--
  @@ -59,7 +61,7 @@
   
       <!-- Define a non-SSL HTTP/1.0 Test Connector on port 8081 -->
       <!--
  -    <Connector className="org.apache.catalina.connector.test.HttpConnector"
  +    <Connector className="org.apache.catalina.connector.http10.HttpConnector"
                  port="8081" minProcessors="5" maxProcessors="75"
                  acceptCount="10" debug="0"/>
       -->
  @@ -127,7 +129,7 @@
         -->
   
         <!-- Define the default virtual host -->
  -      <Host name="localhost" debug="0" appBase="webapps">
  +      <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
   
           <!-- Normally, users must authenticate themselves to each web app
                individually.  Uncomment the following entry if you would like
  
  
  
  1.3       +11 -10    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Container.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Container.java	2000/09/30 19:15:42	1.2
  +++ Container.java	2001/01/23 05:05:44	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Container.java,v 1.2 2000/09/30 19:15:42 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/09/30 19:15:42 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Container.java,v 1.3 2001/01/23 05:05:44 remm Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/01/23 05:05:44 $
    *
    * ====================================================================
    *
  @@ -68,6 +68,7 @@
   import java.beans.PropertyChangeListener;
   import java.io.IOException;
   import javax.servlet.ServletException;
  +import javax.naming.directory.DirContext;
   
   
   /**
  @@ -112,14 +113,14 @@
    *     this Container.
    * <li><b>Realm</b> - Read-only interface to a security domain, for
    *     authenticating user identities and their corresponding roles.
  - * <li><b>Resources</b> - Implementation of the resource access method
  - *     signatures of the <code>ServletContext</code> interface, enabling
  - *     custom linkages to existing server components when Catalina is embedded
  - *     in a larger server.
  + * <li><b>Resources</b> - JNDI directory context enabling access to static
  + *     resources, enabling custom linkages to existing server components when 
  + *     Catalina is embedded in a larger server.
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/09/30 19:15:42 $
  + * @author Remy Maucherat
  + * @version $Revision: 1.3 $ $Date: 2001/01/23 05:05:44 $
    */
   
   public interface Container {
  @@ -310,7 +311,7 @@
        * is no associated Resources object, return the Resources associated with
        * our parent Container (if any); otherwise return <code>null</code>.
        */
  -    public Resources getResources();
  +    public DirContext getResources();
   
   
       /**
  @@ -318,7 +319,7 @@
        *
        * @param resources The newly associated Resources
        */
  -    public void setResources(Resources resources);
  +    public void setResources(DirContext resources);
   
   
       // --------------------------------------------------------- Public Methods
  
  
  
  1.10      +46 -23    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ApplicationContext.java	2001/01/03 00:17:06	1.9
  +++ ApplicationContext.java	2001/01/23 05:05:46	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.9 2001/01/03 00:17:06 craigmcc Exp $
  - * $Revision: 1.9 $
  - * $Date: 2001/01/03 00:17:06 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.10 2001/01/23 05:05:46 remm Exp $
  + * $Revision: 1.10 $
  + * $Date: 2001/01/23 05:05:46 $
    *
    * ====================================================================
    *
  @@ -66,6 +66,7 @@
   
   
   import java.io.InputStream;
  +import java.io.File;
   import java.net.MalformedURLException;
   import java.net.URL;
   import java.util.ArrayList;
  @@ -74,18 +75,21 @@
   import java.util.HashMap;
   import java.util.HashSet;
   import java.util.Set;
  +import javax.naming.directory.DirContext;
   import javax.servlet.RequestDispatcher;
   import javax.servlet.Servlet;
   import javax.servlet.ServletContext;
   import javax.servlet.ServletContextAttributeEvent;
   import javax.servlet.ServletContextAttributesListener;
   import javax.servlet.http.HttpServletRequest;
  +import org.apache.naming.resources.Resource;
  +import org.apache.naming.resources.DirContextURLStreamHandler;
  +import org.apache.naming.resources.DirContextURLConnection;
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Globals;
   import org.apache.catalina.Host;
   import org.apache.catalina.Logger;
  -import org.apache.catalina.Resources;
   import org.apache.catalina.Wrapper;
   import org.apache.catalina.connector.HttpRequestBase;
   import org.apache.catalina.deploy.ApplicationParameter;
  @@ -100,7 +104,8 @@
    * associated with each instance of <code>StandardContext</code>.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.9 $ $Date: 2001/01/03 00:17:06 $
  + * @author Remy Maucherat
  + * @version $Revision: 1.10 $ $Date: 2001/01/23 05:05:46 $
    */
   
   public final class ApplicationContext
  @@ -116,10 +121,11 @@
        *
        * @param context The associated Context instance
        */
  -    public ApplicationContext(StandardContext context) {
  +    public ApplicationContext(String basePath, StandardContext context) {
   
   	super();
   	this.context = context;
  +        this.basePath = basePath;
   
       }
   
  @@ -159,6 +165,12 @@
         StringManager.getManager(Constants.Package);
   
   
  +    /**
  +     * Base path.
  +     */
  +    private String basePath = null;
  +
  +
       // --------------------------------------------------------- Public Methods
   
   
  @@ -167,7 +179,7 @@
        * The path must begin with a "/" and is interpreted as relative to the
        * current context root.
        */
  -    public Resources getResources() {
  +    public DirContext getResources() {
   
   	return context.getResources();
   
  @@ -303,11 +315,15 @@
        */
       public String getMimeType(String file) {
   
  -	Resources resources = context.getResources();
  -	if (resources == null)
  +	if (file == null)
   	    return (null);
  -	else
  -	    return (resources.getMimeType(file));
  +	int period = file.lastIndexOf(".");
  +	if (period < 0)
  +	    return (null);
  +	String extension = file.substring(period + 1);
  +	if (extension.length() < 1)
  +	    return (null);
  +	return (context.findMimeMapping(extension));
   
       }
   
  @@ -343,11 +359,9 @@
        */
       public String getRealPath(String path) {
   
  -	Resources resources = context.getResources();
  -	if (resources == null)
  -	    return (null);
  -	else
  -	    return (resources.getRealPath(path));
  +        // Here, we return a fake path
  +        File file = new File(basePath, path);
  +        return (file.getAbsolutePath());
   
       }
   
  @@ -415,11 +429,12 @@
        */
       public URL getResource(String path) throws MalformedURLException {
   
  -	Resources resources = context.getResources();
  +	DirContext resources = context.getResources();
   	if (resources == null)
   	    return (null);
   	else
  -	    return (resources.getResource(path));
  +	    return new URL("jndi", null, 0, path, 
  +                           new DirContextURLStreamHandler(resources));
   
       }
   
  @@ -434,11 +449,16 @@
        */
       public InputStream getResourceAsStream(String path) {
   
  -	Resources resources = context.getResources();
  -	if (resources == null)
  -	    return (null);
  -	else
  -	    return (resources.getResourceAsStream(path));
  +        DirContext resources = context.getResources();
  +        if (resources != null) {
  +            try {
  +                Object resource = resources.lookup(path);
  +                if (resource instanceof Resource)
  +                    return (((Resource) resource).streamContent());
  +            } catch (Exception e) {
  +            }
  +        }
  +        return (null);
   
       }
   
  @@ -451,6 +471,8 @@
       public Set getResourcePaths() {
   
           ResourceSet set = new ResourceSet();
  +        // FIXME !
  +        /*
           Resources resources = context.getResources();
           if (resources == null) {
               set.setLocked(true);
  @@ -461,6 +483,7 @@
               paths = new String[0];
           for (int i = 0; i < paths.length; i++)
               set.add(paths[i]);
  +        */
           set.setLocked(true);
           return (set);
   
  
  
  
  1.8       +20 -40    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ContainerBase.java
  
  Index: ContainerBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ContainerBase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContainerBase.java	2001/01/23 02:51:14	1.7
  +++ ContainerBase.java	2001/01/23 05:05:46	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ContainerBase.java,v 1.7 2001/01/23 02:51:14 craigmcc Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/01/23 02:51:14 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ContainerBase.java,v 1.8 2001/01/23 05:05:46 remm Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/01/23 05:05:46 $
    *
    * ====================================================================
    *
  @@ -70,8 +70,11 @@
   import java.io.IOException;
   import java.util.ArrayList;
   import java.util.HashMap;
  +import java.util.Hashtable;
   import java.util.Iterator;
   import javax.servlet.ServletException;
  +import javax.naming.directory.DirContext;
  +import org.apache.naming.resources.ProxyDirContext;
   import org.apache.catalina.Container;
   import org.apache.catalina.ContainerEvent;
   import org.apache.catalina.ContainerListener;
  @@ -86,7 +89,6 @@
   import org.apache.catalina.Pipeline;
   import org.apache.catalina.Realm;
   import org.apache.catalina.Request;
  -import org.apache.catalina.Resources;
   import org.apache.catalina.Response;
   import org.apache.catalina.Valve;
   import org.apache.catalina.util.LifecycleSupport;
  @@ -151,7 +153,7 @@
    * class comments of the implementation class.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.7 $ $Date: 2001/01/23 02:51:14 $
  + * @version $Revision: 1.8 $ $Date: 2001/01/23 05:05:46 $
    */
   
   public abstract class ContainerBase
  @@ -252,9 +254,9 @@
   
   
       /**
  -     * The Resources object with which this Container is associated.
  +     * The resources DirContext object with which this Container is associated.
        */
  -    protected Resources resources = null;
  +    protected DirContext resources = null;
   
   
       /**
  @@ -650,11 +652,12 @@
   
   
       /**
  -     * Return the Resources with which this Container is associated.  If there
  -     * is no associated Resources object, return the Resources associated with
  -     * our parent Container (if any); otherwise return <code>null</code>.
  +      * Return the resources DirContext object with which this Container is 
  +      * associated.  If there is no associated resources object, return the 
  +      * resources associated with our parent Container (if any); otherwise 
  +      * return <code>null</code>.
        */
  -    public Resources getResources() {
  +    public DirContext getResources() {
   
   	if (resources != null)
   	    return (resources);
  @@ -666,41 +669,18 @@
   
   
       /**
  -     * Set the Resources object with which this Container is associated.
  +     * Set the resources DirContext object with which this Container is 
  +     * associated.
        *
  -     * @param resources The newly associated Resources
  +     * @param resources The newly associated DirContext
        */
  -    public synchronized void setResources(Resources resources) {
  +    public synchronized void setResources(DirContext resources) {
   
   	// Change components if necessary
  -	Resources oldResources = this.resources;
  +	DirContext oldResources = this.resources;
   	if (oldResources == resources)
   	    return;
  -	this.resources = resources;
  -
  -	// Stop the old component if necessary
  -	if (started && (oldResources != null) &&
  -	    (oldResources instanceof Lifecycle)) {
  -	    try {
  -		((Lifecycle) oldResources).stop();
  -	    } catch (LifecycleException e) {
  -		log("ContainerBase.setResources: stop: ", e);
  -	    }
  -	}
  -	if (oldResources != null)
  -	    oldResources.setContainer(null);
  -
  -	// Start the new component if necessary
  -	if (resources != null)
  -	    resources.setContainer(this);
  -	if (started && (resources != null) &&
  -	    (resources instanceof Lifecycle)) {
  -	    try {
  -		((Lifecycle) resources).start();
  -	    } catch (LifecycleException e) {
  -		log("ContainerBase.setResources: start: ", e);
  -	    }
  -	}
  +        this.resources = new ProxyDirContext(new Hashtable(), resources);
   
   	// Report this property change to interested listeners
   	support.firePropertyChange("resources", oldResources, this.resources);
  
  
  
  1.35      +93 -9     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.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- StandardContext.java	2001/01/23 02:51:14	1.34
  +++ StandardContext.java	2001/01/23 05:05:46	1.35
  @@ -1,13 +1,13 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v 1.34 2001/01/23 02:51:14 craigmcc Exp $
  - * $Revision: 1.34 $
  - * $Date: 2001/01/23 02:51:14 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v 1.35 2001/01/23 05:05:46 remm Exp $
  + * $Revision: 1.35 $
  + * $Date: 2001/01/23 05:05:46 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -88,6 +88,7 @@
   import javax.naming.NamingEnumeration;
   import javax.naming.Binding;
   import javax.naming.StringRefAddr;
  +import javax.naming.directory.DirContext;
   import org.apache.naming.NamingContext;
   import org.apache.naming.ContextBindings;
   import org.apache.naming.ContextAccessController;
  @@ -95,9 +96,13 @@
   import org.apache.naming.ResourceRef;
   import org.apache.naming.ResourceEnvRef;
   import org.apache.naming.TransactionRef;
  +import org.apache.naming.resources.FileDirContext;
  +import org.apache.naming.resources.WARDirContext;
  +import org.apache.naming.resources.BaseDirContext;
   import org.apache.catalina.Container;
   import org.apache.catalina.ContainerListener;
   import org.apache.catalina.Context;
  +import org.apache.catalina.Host;
   import org.apache.catalina.Globals;
   import org.apache.catalina.HttpRequest;
   import org.apache.catalina.InstanceListener;
  @@ -120,7 +125,6 @@
   import org.apache.catalina.deploy.SecurityCollection;
   import org.apache.catalina.deploy.SecurityConstraint;
   import org.apache.catalina.loader.StandardLoader;
  -import org.apache.catalina.resources.FileResources;
   import org.apache.catalina.session.StandardManager;
   import org.apache.catalina.util.CharsetMapper;
   import org.apache.catalina.util.RequestUtil;
  @@ -133,7 +137,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.34 $ $Date: 2001/01/23 02:51:14 $
  + * @version $Revision: 1.35 $ $Date: 2001/01/23 05:05:46 $
    */
   
   public class StandardContext
  @@ -842,7 +846,7 @@
       public synchronized ServletContext getServletContext() {
   
   	if (context == null)
  -	    context = new ApplicationContext(this);
  +	    context = new ApplicationContext(getBasePath(), this);
   	return (context);
   
       }
  @@ -900,6 +904,27 @@
       }
   
   
  +    /**
  +     * Set the resources DirContext object with which this Container is 
  +     * associated.
  +     *
  +     * @param resources The newly associated DirContext
  +     */
  +    public synchronized void setResources(DirContext resources) {
  +
  +        if (resources instanceof BaseDirContext) {
  +            if (resources instanceof BaseDirContext)
  +                ((BaseDirContext) resources).setDocBase(getBasePath());
  +        }
  +        super.setResources(resources);
  +        if (started)
  +            // We put the resources into the servlet context
  +            getServletContext().setAttribute
  +                (Globals.RESOURCES_ATTR, getResources());
  +
  +    }
  +
  +
       // ------------------------------------------------------ Public Properties
   
   
  @@ -2887,7 +2912,10 @@
           if (getResources() == null) {   // (1) Required by Loader
               if (debug >= 1)
                   log("Configuring default Resources");
  -            setResources(new FileResources());
  +            if ((docBase != null) && (docBase.endsWith(".war")))
  +                setResources(new WARDirContext());
  +            else
  +                setResources(new FileDirContext());
           }
           if (getLoader() == null) {      // (2) Required by Manager
               if (debug >= 1)
  @@ -2900,6 +2928,9 @@
               setManager(new StandardManager());
           }
   
  +        // Post work directory
  +	postWorkDirectory();
  +
   	// Standard container startup
           if (debug >= 1)
               log("Processing standard container startup");
  @@ -2925,6 +2956,10 @@
               }
           }
   
  +        // We put the resources into the servlet context
  +        getServletContext().setAttribute
  +            (Globals.RESOURCES_ATTR, getResources());
  +
           // Configure and call application event listeners and filters
           listenerStart();
           filterStart();
  @@ -2933,7 +2968,6 @@
           if (debug >= 1)
               log("Posting standard context attributes");
   	postWelcomeFiles();
  -	postWorkDirectory();
   
           // Reload sessions from persistent storage if supported
           try {
  @@ -3100,10 +3134,51 @@
       }
   
   
  +    /**
  +     * Return a File object representing the base directory for the
  +     * entire servlet container (i.e. the Engine container if present).
  +     */
  +    protected File engineBase() {
  +
  +	return (new File(System.getProperty("catalina.home")));
  +
  +    }
  +
  +
       // -------------------------------------------------------- Private Methods
   
   
       /**
  +     * Get base path.
  +     */
  +    private String getBasePath() {
  +        String docBase = null;
  +        Container container = this;
  +        while (container != null) {
  +            if (container instanceof Host)
  +                break;
  +            container = container.getParent();
  +        }
  +        if (container == null) {
  +            docBase = (new File(engineBase(), getDocBase())).getPath();
  +        } else {
  +            File file = new File(getDocBase());
  +            if (!file.isAbsolute()) {
  +                // Use the "appBase" property of this container
  +                String appBase = ((Host) container).getAppBase();
  +                file = new File(appBase);
  +                if (!file.isAbsolute())
  +                    file = new File(engineBase(), appBase);
  +                docBase = (new File(file, getDocBase())).getPath();
  +            } else {
  +                docBase = file.getPath();
  +            }
  +        }
  +        return docBase;
  +    }
  +
  +
  +    /**
        * Create and initialize the JNDI naming context.
        */
       private void createNamingContext()
  @@ -3236,9 +3311,18 @@
           try {
               Reference ref = new TransactionRef();
               compCtx.bind("UserTransaction", ref);
  +            addAdditionalParameters(ref, "UserTransaction");
  +        } catch (NamingException e) {
  +            log(sm.getString("standardContext.bindFailed", e));
  +        }
  +
  +        // Binding the resources directory context
  +        try {
  +            compCtx.bind("Resources", getResources());
           } catch (NamingException e) {
               log(sm.getString("standardContext.bindFailed", e));
           }
  +
   
           // Setting the context in read only mode
           ContextAccessController.setReadOnly(getName());
  
  
  
  1.8       +65 -22    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java
  
  Index: StandardHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardHost.java	2001/01/23 02:51:15	1.7
  +++ StandardHost.java	2001/01/23 05:05:47	1.8
  @@ -1,13 +1,13 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v 1.7 2001/01/23 02:51:15 craigmcc Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/01/23 02:51:15 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v 1.8 2001/01/23 05:05:47 remm Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/01/23 05:05:47 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -97,7 +97,7 @@
    * requests directed to a particular web application.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.7 $ $Date: 2001/01/23 02:51:15 $
  + * @version $Revision: 1.8 $ $Date: 2001/01/23 05:05:47 $
    */
   
   public class StandardHost
  @@ -173,6 +173,12 @@
   	"org.apache.catalina.core.StandardHostMapper";
   
   
  +    /**
  +     * Unpack WARs property.
  +     */
  +    private boolean unpackWARs = true;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -290,6 +296,26 @@
       }
   
   
  +    /**
  +     * Unpack WARs flag accessor.
  +     */
  +    public boolean isUnpackWARs() {
  +
  +        return (unpackWARs);
  +
  +    }
  +
  +
  +    /**
  +     * Unpack WARs flag mutator.
  +     */
  +    public void setUnpackWARs(boolean unpackWARs) {
  +
  +        this.unpackWARs = unpackWARs;
  +
  +    }
  +
  +
       // --------------------------------------------------------- Public Methods
   
   
  @@ -513,22 +539,39 @@
           log(sm.getString("standardHost.deploying", contextPath, url));
   
           // Expand a WAR archive into an unpacked directory if needed
  -        if (url.startsWith("jar:"))
  -            docBase = expand(war);
  -        else if (url.startsWith("file://"))
  -            docBase = url.substring(7);
  -        else if (url.startsWith("file:"))
  -            docBase = url.substring(5);
  -        else
  -            throw new IllegalArgumentException
  -                (sm.getString("standardHost.warURL", url));
  -
  -        // Make sure the document base directory exists and is readable
  -        File docBaseDir = new File(docBase);
  -        if (!docBaseDir.exists() || !docBaseDir.isDirectory() ||
  -            !docBaseDir.canRead())
  -            throw new IllegalArgumentException
  -                (sm.getString("standardHost.accessBase", docBase));
  +        if (isUnpackWARs()) {
  +            
  +            if (url.startsWith("jar:"))
  +                docBase = expand(war);
  +            else if (url.startsWith("file://"))
  +                docBase = url.substring(7);
  +            else if (url.startsWith("file:"))
  +                docBase = url.substring(5);
  +            else
  +                throw new IllegalArgumentException
  +                    (sm.getString("standardHost.warURL", url));
  +            
  +            // Make sure the document base directory exists and is readable
  +            File docBaseDir = new File(docBase);
  +            if (!docBaseDir.exists() || !docBaseDir.isDirectory() ||
  +                !docBaseDir.canRead())
  +                throw new IllegalArgumentException
  +                    (sm.getString("standardHost.accessBase", docBase));
  +            
  +        } else {
  +            
  +            if (url.startsWith("jar:")) {
  +                url = url.substring(4, url.length() - 2);
  +            }
  +            if (url.startsWith("file://"))
  +                docBase = url.substring(7);
  +            else if (url.startsWith("file:"))
  +                docBase = url.substring(5);
  +            else
  +                throw new IllegalArgumentException
  +                    (sm.getString("standardHost.warURL", url));
  +            
  +        }
   
           // Deploy this new web application
           try {
  @@ -544,7 +587,7 @@
               }
               addChild(context);
   	    fireContainerEvent(DEPLOY_EVENT, context);
  -            if (url.startsWith("jar:")) {
  +            if (isUnpackWARs() && (url.startsWith("jar:"))) {
                   synchronized (expanded) {
                       if (debug >= 1)
                           log("Recording expanded app at path " + contextPath);
  
  
  
  1.7       +129 -19   jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java
  
  Index: StandardClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StandardClassLoader.java	2001/01/17 15:33:46	1.6
  +++ StandardClassLoader.java	2001/01/23 05:05:48	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v 1.6 2001/01/17 15:33:46 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/01/17 15:33:46 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v 1.7 2001/01/23 05:05:48 remm Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/01/23 05:05:48 $
    *
    * ====================================================================
    *
  @@ -71,11 +71,16 @@
   import java.net.MalformedURLException;
   import java.net.URL;
   import java.net.URLClassLoader;
  +import java.net.URLConnection;
  +import java.net.URLStreamHandlerFactory;
  +import java.net.URLStreamHandler;
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.jar.JarFile;
  +import java.util.jar.JarEntry;
  +import java.util.jar.JarInputStream;
   import java.util.jar.Manifest;
   
   
  @@ -99,7 +104,8 @@
    * independently.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2001/01/17 15:33:46 $
  + * @author Remy Maucherat
  + * @version $Revision: 1.7 $ $Date: 2001/01/23 05:05:48 $
    */
   
   public class StandardClassLoader
  @@ -122,6 +128,20 @@
   
   
       /**
  +     * Construct a new ClassLoader with no defined repositories and no
  +     * parent ClassLoader, but with a stream handler factory.
  +     * 
  +     * @param factory the URLStreamHandlerFactory to use when creating URLs
  +     */
  +    public StandardClassLoader(URLStreamHandlerFactory factory) {
  +
  +        super(new URL[0], null, factory);
  +        this.factory = factory;
  +
  +    }
  +
  +
  +    /**
        * Construct a new ClassLoader with no defined repositories and the
        * specified parent ClassLoader.
        *
  @@ -135,6 +155,22 @@
   
   
       /**
  +     * Construct a new ClassLoader with no defined repositories and the
  +     * specified parent ClassLoader.
  +     *
  +     * @param parent The parent ClassLoader
  +     * @param factory the URLStreamHandlerFactory to use when creating URLs
  +     */
  +    public StandardClassLoader(ClassLoader parent, 
  +                               URLStreamHandlerFactory factory) {
  +
  +        super((new URL[0]), parent, factory);
  +        this.factory = factory;
  +
  +    }
  +
  +
  +    /**
        * Construct a new ClassLoader with the specified repositories and
        * no parent ClassLoader.
        *
  @@ -263,6 +299,12 @@
       protected String systems[] = { "java." };
   
   
  +    /**
  +     * URL stream handler for additional protocols.
  +     */
  +    protected URLStreamHandlerFactory factory = null;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -352,7 +394,12 @@
   
           // Add this repository to our underlying class loader
           try {
  -            super.addURL(new URL(repository));
  +            URLStreamHandler streamHandler = null;
  +            String protocol = parseProtocol(repository);
  +            if (factory != null)
  +                streamHandler = factory.createURLStreamHandler(protocol);
  +            URL url = new URL(null, repository, streamHandler);
  +            super.addURL(url);
           } catch (MalformedURLException e) {
               throw new IllegalArgumentException(e.toString());
           }
  @@ -553,14 +600,27 @@
   
           // Check for modifications to any of these classes
           for (int i = 0; i < entries.length; i++) {
  -            if (!(entries[i].origin instanceof File))
  -                continue;
  -            File origin = (File) entries[i].origin;
  -            if (entries[i].lastModified != origin.lastModified()) {
  -                if (debug >= 2)
  -                    log("  Class '" + entries[i].loadedClass.getName() +
  -                        "' was modified");
  -                return (true);
  +            if (entries[i].origin instanceof File) {
  +                File origin = (File) entries[i].origin;
  +                if (entries[i].lastModified != origin.lastModified()) {
  +                    if (debug >= 2)
  +                        log("  Class '" + entries[i].loadedClass.getName() +
  +                            "' was modified");
  +                    return (true);
  +                }
  +            } else if (entries[i].origin instanceof URL) {
  +                try {
  +                    URL url = (URL) entries[i].origin;
  +                    URLConnection urlConn = url.openConnection();
  +                    if (entries[i].lastModified != urlConn.getLastModified()) {
  +                        if (debug >= 2)
  +                            log("  Class '" 
  +                                + entries[i].loadedClass.getName() 
  +                                + "' was modified");
  +                        return (true);
  +                    }
  +                } catch (IOException e) {
  +                }
               }
           }
   
  @@ -1028,6 +1088,21 @@
   
   
       /**
  +     * Parse URL protocol.
  +     * 
  +     * @return String protocol
  +     */
  +    protected static String parseProtocol(String spec) {
  +        if (spec == null)
  +            return "";
  +        int pos = spec.indexOf(':');
  +        if (pos <= 0)
  +            return "";
  +        return spec.substring(0, pos).trim();
  +    }
  +
  +
  +    /**
        * Add a repository to our internal array only.
        *
        * @param repository The new repository
  @@ -1037,12 +1112,18 @@
        */
       protected void addRepositoryInternal(String repository) {
   
  +        URLStreamHandler streamHandler = null;
  +        String protocol = parseProtocol(repository);
  +        if (factory != null)
  +            streamHandler = factory.createURLStreamHandler(protocol);
  +
           // Validate the manifest of a JAR file repository
           if (!repository.endsWith("/")) {
               try {
                   JarFile jarFile = null;
  +                Manifest manifest = null;
                   if (repository.startsWith("jar:")) {
  -                    URL url = new URL(repository);
  +                    URL url = new URL(null, repository, streamHandler);
                       JarURLConnection conn =
                           (JarURLConnection) url.openConnection();
                       conn.setAllowUserInteraction(false);
  @@ -1054,13 +1135,20 @@
                       jarFile = new JarFile(repository.substring(7));
                   } else if (repository.startsWith("file:")) {
                       jarFile = new JarFile(repository.substring(5));
  +                } else if (repository.endsWith(".jar")) {
  +                    URL url = new URL(null, repository, streamHandler);
  +                    URLConnection conn = url.openConnection();
  +                    JarInputStream jis = 
  +                        new JarInputStream(conn.getInputStream());
  +                    manifest = jis.getManifest();
                   } else {
                       throw new IllegalArgumentException
                           ("addRepositoryInternal:  Invalid URL '" +
                            repository + "'");
                   }
  -                Manifest manifest = jarFile.getManifest();
  -                if (manifest != null) {
  +                if (!((manifest == null) && (jarFile == null))) {
  +                    if ((manifest == null) && (jarFile != null))
  +                        manifest = jarFile.getManifest();
                       Iterator extensions =
                           Extension.getAvailable(manifest).iterator();
                       while (extensions.hasNext())
  @@ -1070,9 +1158,12 @@
                       while (extensions.hasNext())
                           required.add(extensions.next());
                   }
  -                jarFile.close();
  +                if (jarFile != null)
  +                    jarFile.close();
               } catch (Throwable t) {
  -                throw new IllegalArgumentException("addRepositoryInternal: " + t);
  +                t.printStackTrace();
  +                throw new IllegalArgumentException
  +                    ("addRepositoryInternal: " + t);
               }
           }
   
  @@ -1093,11 +1184,30 @@
        * @param input The array of String to be converted
        */
       protected static URL[] convert(String input[]) {
  +        return convert(input, null);
  +    }
  +
  +
  +    /**
  +     * Convert an array of String to an array of URL and return it.
  +     *
  +     * @param input The array of String to be converted
  +     * @param factory Handler factory to use to generate the URLs
  +     */
  +    protected static URL[] convert(String input[], 
  +                                   URLStreamHandlerFactory factory) {
  +
  +        URLStreamHandler streamHandler = null;
   
           URL url[] = new URL[input.length];
           for (int i = 0; i < url.length; i++) {
               try {
  -                url[i] = new URL(input[i]);
  +                String protocol = parseProtocol(input[i]);
  +                if (factory != null)
  +                    streamHandler = factory.createURLStreamHandler(protocol);
  +                else
  +                    streamHandler = null;
  +                url[i] = new URL(null, input[i], streamHandler);
               } catch (MalformedURLException e) {
                   url[i] = null;
               }
  
  
  
  1.14      +120 -31   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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StandardLoader.java	2000/12/22 00:37:50	1.13
  +++ StandardLoader.java	2001/01/23 05:05:48	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v 1.13 2000/12/22 00:37:50 craigmcc Exp $
  - * $Revision: 1.13 $
  - * $Date: 2000/12/22 00:37:50 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v 1.14 2001/01/23 05:05:48 remm Exp $
  + * $Revision: 1.14 $
  + * $Date: 2001/01/23 05:05:48 $
    *
    * ====================================================================
    *
  @@ -70,10 +70,19 @@
   import java.beans.PropertyChangeSupport;
   import java.io.File;
   import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.FileOutputStream;
  +import java.io.OutputStream;
   import java.net.MalformedURLException;
   import java.net.URL;
   import java.net.URLClassLoader;
  +import java.net.URLStreamHandlerFactory;
   import javax.servlet.ServletContext;
  +import javax.naming.NamingException;
  +import javax.naming.NameClassPair;
  +import javax.naming.NamingEnumeration;
  +import javax.naming.directory.DirContext;
  +import org.apache.naming.resources.DirContextURLStreamHandlerFactory;
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Globals;
  @@ -83,7 +92,6 @@
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Loader;
   import org.apache.catalina.Logger;
  -import org.apache.catalina.Resources;
   import org.apache.catalina.util.LifecycleSupport;
   import org.apache.catalina.util.StringManager;
   
  @@ -101,7 +109,8 @@
    * is not present, the system class loader will be used instead.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.13 $ $Date: 2000/12/22 00:37:50 $
  + * @author Remy Maucherat
  + * @version $Revision: 1.14 $ $Date: 2001/01/23 05:05:48 $
    */
   
   public final class StandardLoader
  @@ -581,10 +590,16 @@
   
   	// Construct a class loader based on our current repositories list
   	try {
  +            URLStreamHandlerFactory shFactory = null;
  +            if ((this.container != null) && 
  +                (this.container.getResources() != null))
  +                shFactory = new DirContextURLStreamHandlerFactory
  +                    (this.container.getResources());
   	    if (parentClassLoader == null)
  -	        classLoader = new StandardClassLoader();
  +	        classLoader = new StandardClassLoader(shFactory);
   	    else
  -	        classLoader = new StandardClassLoader(parentClassLoader);
  +	        classLoader = new StandardClassLoader
  +                    (parentClassLoader, shFactory);
   	    for (int i = 0; i < repositories.length; i++)
   		classLoader.addRepository(repositories[i]);
   	    classLoader.addRestricted("org.apache.catalina.");
  @@ -794,6 +809,9 @@
                       repository = repository.substring(7);
                   else if (repository.startsWith("file:"))
                       repository = repository.substring(5);
  +                else if (repository.startsWith("jndi:"))
  +                    repository = 
  +                        servletContext.getRealPath(repository.substring(5));
                   else
                       continue;
                   if (repository.endsWith("/"))
  @@ -809,7 +827,7 @@
           }
   
           // Store the assembled class path as a servlet context attribute
  -	servletContext.setAttribute(Globals.CLASS_PATH_ATTR,
  +        servletContext.setAttribute(Globals.CLASS_PATH_ATTR,
   				    classpath.toString());
   
       }
  @@ -823,12 +841,13 @@
   
           if (!(container instanceof Context))
               return;
  -	Resources resources = ((Context) container).getResources();
  +	ServletContext servletContext = 
  +            ((Context) container).getServletContext();
   
   	// Add the WEB-INF/classes subdirectory
  -	URL classesURL = null;
  +        URL classesURL = null;
   	try {
  -	    classesURL = resources.getResource("/WEB-INF/classes");
  +            classesURL = servletContext.getResource("/WEB-INF/classes");
           } catch (MalformedURLException e) {
   	    classesURL = null;
   	}
  @@ -856,24 +875,69 @@
               }
               addRepository(classesURLString + "/");
           }
  +        
  +        // Loading the work directory
  +        File workDir = 
  +            (File) servletContext.getAttribute(Globals.WORK_DIR_ATTR);
  +
  +        if (workDir != null) {
  +
  +            DirContext resources = container.getResources();
  +            String libName = "/WEB-INF/lib";
  +            DirContext libDir = null;
  +            // Looking up directory /WEB-INF/lib in the context
  +            try {
  +                Object object = resources.lookup(libName);
  +                if (object instanceof DirContext)
  +                    libDir = (DirContext) object;
  +            } catch(NamingException e) {
  +                // Silent catch: it's valid that no /WEB-INF/lib directory 
  +                //exists
  +            }
   
  -	// Add the WEB-INF/lib/*.jar files
  -	URL libURL = null;
  -	try {
  -	    libURL = resources.getResource("/WEB-INF/lib");
  -	} catch (MalformedURLException e) {
  -	    libURL = null;
  -	}
  -        // FIXME - This still requires disk directory!  Scan JARs if present
  -	if ((libURL != null) && "file".equals(libURL.getProtocol())) {
  -	    File libFile = new File(libURL.getFile());
  -	    if (libFile.exists() && libFile.canRead() &&
  -	        libFile.isDirectory()) {
  -		String filenames[] = libFile.list();
  -		for (int i = 0; i < filenames.length; i++) {
  -		    if (!filenames[i].endsWith(".jar"))
  -		        continue;
  -		    File jarFile = new File(libFile, filenames[i]);
  +            // Add the WEB-INF/lib/*.jar files
  +            if (libDir != null) {
  +                // Enumerate children
  +                try {
  +                    NamingEnumeration enum = resources.list(libName);
  +                    while (enum.hasMoreElements()) {
  +                        NameClassPair ncPair = 
  +                            (NameClassPair) enum.nextElement();
  +                        String filename = ncPair.getName();
  +                        if (!filename.endsWith(".jar"))
  +                            continue;
  +                        try {
  +                            URL fileURL = servletContext.getResource
  +                                (libName + "/" + filename);
  +                            log(" Adding '" + "file: " +
  +                                libName + "/" + filename + "'");
  +                            // Copying the file to the work dir
  +                            File dest = new File(workDir, filename);
  +                            if (copyJAR(fileURL.openStream(), 
  +                                        new FileOutputStream(dest)))
  +                                addRepository(dest.toURL().toString());
  +                        } catch (MalformedURLException e) {
  +                        } catch (IOException e) {
  +                        }
  +                    }
  +                } catch(NamingException e) {
  +                }
  +            }
  +
  +        } else {
  +
  +            // Add the WEB-INF/lib/*.jar files
  +            // This requires disk directory!  Scan JARs if present
  +
  +            File libFile = new File(((Context) container).getDocBase(), 
  +                                    "/WEB-INF/lib");
  +            if (libFile.exists() && libFile.canRead() &&
  +                libFile.isDirectory()) {
  +                String filenames[] = libFile.list();
  +                for (int i = 0; i < filenames.length; i++) {
  +                    if (!filenames[i].endsWith(".jar"))
  +                        continue;
  +                    File jarFile = new File(libFile, filenames[i]);
                       try {
                           if (debug > 0)
                               log(" Adding '" + "file: " +
  @@ -882,9 +946,34 @@
                       } catch (IOException e) {
                           log(jarFile.getAbsolutePath(), e);
                       }
  -		}
  -	    }
  -	}
  +                }
  +            }
  +
  +        }
  +
  +    }
  +
  +
  +    /**
  +     * Copy a JAR file to the specified temp directory.
  +     */
  +    private boolean copyJAR(InputStream is, OutputStream os) {
  +
  +        try {
  +            byte[] buf = new byte[4096];
  +            while (true) {
  +                int len = is.read(buf);
  +                if (len < 0)
  +                    break;
  +                os.write(buf, 0, len);
  +            }
  +            is.close();
  +            os.close();
  +        } catch (IOException e) {
  +            return false;
  +        }
  +
  +        return true;
   
       }
   
  
  
  
  1.9       +9 -9      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java
  
  Index: Bootstrap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Bootstrap.java	2000/12/21 23:47:20	1.8
  +++ Bootstrap.java	2001/01/23 05:05:51	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v 1.8 2000/12/21 23:47:20 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/12/21 23:47:20 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v 1.9 2001/01/23 05:05:51 remm Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/01/23 05:05:51 $
    *
    * ====================================================================
    *
  @@ -85,7 +85,7 @@
    * class path and therefore not visible to application level classes.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2000/12/21 23:47:20 $
  + * @version $Revision: 1.9 $ $Date: 2001/01/23 05:05:51 $
    */
   
   public final class Bootstrap {
  @@ -117,9 +117,9 @@
           }
   
           // Construct the class loaders we will need
  -        ClassLoader systemLoader = createSystemLoader();
  -        ClassLoader catalinaLoader = createCatalinaLoader(systemLoader);
  -        ClassLoader sharedLoader = createSharedLoader(systemLoader);
  +        ClassLoader commonLoader = createCommonLoader();
  +        ClassLoader catalinaLoader = createCatalinaLoader(commonLoader);
  +        ClassLoader sharedLoader = createSharedLoader(commonLoader);
   
   	// Load our startup class and call its process() method
   	try {
  @@ -171,10 +171,10 @@
        * Construct and return the class loader to be used for loading
        * of the shared system classes.
        */
  -    private static ClassLoader createSystemLoader() {
  +    private static ClassLoader createCommonLoader() {
   
           if (debug >= 1)
  -            log("Creating SYSTEM class loader");
  +            log("Creating COMMON class loader");
   
           // Construct the "class path" for this class loader
           ArrayList list = new ArrayList();
  
  
  
  1.12      +10 -10    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java
  
  Index: Catalina.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Catalina.java	2001/01/04 20:05:39	1.11
  +++ Catalina.java	2001/01/23 05:05:51	1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v 1.11 2001/01/04 20:05:39 craigmcc Exp $
  - * $Revision: 1.11 $
  - * $Date: 2001/01/04 20:05:39 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v 1.12 2001/01/23 05:05:51 remm Exp $
  + * $Revision: 1.12 $
  + * $Date: 2001/01/23 05:05:51 $
    *
    * ====================================================================
    *
  @@ -96,7 +96,7 @@
    * </u>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.11 $ $Date: 2001/01/04 20:05:39 $
  + * @version $Revision: 1.12 $ $Date: 2001/01/23 05:05:51 $
    */
   
   public class Catalina {
  @@ -367,12 +367,12 @@
   
   	mapper.addRule("Server/Service/Engine/Host/Resources",
                          mapper.objectCreate
  -		       ("org.apache.catalina.core.StandardResources",
  +		       ("org.apache.naming.resources.FileDirContext",
   			"className"));
   	mapper.addRule("Server/Service/Engine/Host/Resources",
                          mapper.setProperties());
   	mapper.addRule("Server/Service/Engine/Host/Resources", mapper.addChild
  -		       ("setResources", "org.apache.catalina.Resources"));
  +		       ("setResources", "javax.naming.directory.DirContext"));
   
   	mapper.addRule("Server/Service/Engine/Host/Valve", mapper.objectCreate
   		       (null, "className"));
  @@ -402,12 +402,12 @@
   		       ("setRealm", "org.apache.catalina.Realm"));
   
   	mapper.addRule("Server/Service/Engine/Resources", mapper.objectCreate
  -		       ("org.apache.catalina.core.StandardResources",
  +		       ("org.apache.naming.resources.FileDirContext",
   			"className"));
   	mapper.addRule("Server/Service/Engine/Resources",
                          mapper.setProperties());
   	mapper.addRule("Server/Service/Engine/Resources", mapper.addChild
  -		       ("setResources", "org.apache.catalina.Resources"));
  +		       ("setResources", "javax.naming.directory.DirContext"));
   
   	mapper.addRule("Server/Service/Engine/Valve", mapper.objectCreate
   		       (null, "className"));
  @@ -540,12 +540,12 @@
   
   	mapper.addRule(prefix + "/Resources",
   		       mapper.objectCreate
  -		       ("org.apache.catalina.core.StandardResources",
  +		       ("org.apache.naming.resources.FileDirContext",
   			"className"));
   	mapper.addRule(prefix + "/Resources",
   		       mapper.setProperties());
   	mapper.addRule(prefix + "/Resources", mapper.addChild
  -		       ("setResources", "org.apache.catalina.Resources"));
  +		       ("setResources", "javax.naming.directory.DirContext"));
   
   	mapper.addRule(prefix + "/Valve", mapper.objectCreate
   		       (null, "className"));
  
  
  
  1.37      +14 -14    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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ContextConfig.java	2001/01/23 02:52:00	1.36
  +++ ContextConfig.java	2001/01/23 05:05:51	1.37
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v 1.36 2001/01/23 02:52:00 craigmcc Exp $
  - * $Revision: 1.36 $
  - * $Date: 2001/01/23 02:52:00 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v 1.37 2001/01/23 05:05:51 remm Exp $
  + * $Revision: 1.37 $
  + * $Date: 2001/01/23 05:05:51 $
    *
    * ====================================================================
    *
  @@ -89,6 +89,7 @@
   import java.util.Stack;
   import java.util.jar.JarEntry;
   import java.util.jar.JarFile;
  +import javax.servlet.ServletContext;
   import org.apache.catalina.Authenticator;
   import org.apache.catalina.Context;
   import org.apache.catalina.Globals;
  @@ -97,7 +98,6 @@
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Logger;
   import org.apache.catalina.Pipeline;
  -import org.apache.catalina.Resources;
   import org.apache.catalina.Valve;
   import org.apache.catalina.Wrapper;
   import org.apache.catalina.core.ContainerBase;
  @@ -118,7 +118,7 @@
    * of that Context, and the associated defined servlets.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.36 $ $Date: 2001/01/23 02:52:00 $
  + * @version $Revision: 1.37 $ $Date: 2001/01/23 05:05:51 $
    */
   
   public final class ContextConfig
  @@ -225,10 +225,10 @@
   
   	// Open the application web.xml file, if it exists
   	InputStream stream = null;
  -	Resources resources = context.getResources();
  -	if (resources != null)
  -	    stream =
  -		resources.getResourceAsStream(Constants.ApplicationWebXml);
  + 	ServletContext servletContext = context.getServletContext();
  +        if (servletContext != null)
  +            stream = servletContext.getResourceAsStream
  +                (Constants.ApplicationWebXml);
   	if (stream == null) {
   	    log(sm.getString("contextConfig.applicationMissing"));
   	    return;
  @@ -785,11 +785,11 @@
           // Accumulate the common permissions we will add to all code sources
           if (debug >= 1)
               log("Building common permissions to add");
  -        Resources resources = context.getResources();
  +        ServletContext servletContext = context.getServletContext();
           Permissions commonPerms = new Permissions();
           URL baseURL = null;
           try {
  -            baseURL = resources.getResource("/");
  +            baseURL = servletContext.getResource("/");
               if (debug >= 1)
                   log(" baseURL=" + baseURL.toString());
           } catch (MalformedURLException e) {
  @@ -822,7 +822,7 @@
               log("Building document root code source");
           URL docURL = null;
           try {
  -            docURL = resources.getResource("/WEB-INF");
  +            docURL = servletContext.getResource("/WEB-INF");
               if (debug >= 1)
                   log(" docURL=" + docURL.toString());
           } catch (MalformedURLException e) {
  @@ -977,10 +977,10 @@
           // FIXME - Yet another dependence on files
           if (debug >= 1)
               log("Scanning library JAR files");
  -	Resources resources = context.getResources();
  +	ServletContext servletContext = context.getServletContext();
           URL libURL = null;
           try {
  -            libURL = resources.getResource("/WEB-INF/lib");
  +            libURL = servletContext.getResource("/WEB-INF/lib");
           } catch (MalformedURLException e) {
               ;
           }