You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by gl...@apache.org on 2002/02/28 18:20:57 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardContext.java StandardHost.java

glenn       02/02/28 09:20:56

  Modified:    .        RELEASE-NOTES-4.1-dev.txt
               catalina/docs/config host.html
               catalina/src/share/org/apache/catalina/core
                        StandardContext.java StandardHost.java
  Log:
  Added the Engine name as a directory path component when creating
  the default work directory for a web application.  This fixes a bug
  where the same work directory would be used for the http and https version
  of a virtual host.
  
  Added the workDir attribute to the Host configuration.  This makes it
  easier to set the base directory where the work directories for
  applications are placed when virtual hosting sites with Tomcat.
  
  Revision  Changes    Path
  1.3       +9 -1      jakarta-tomcat-4.0/RELEASE-NOTES-4.1-dev.txt
  
  Index: RELEASE-NOTES-4.1-dev.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/RELEASE-NOTES-4.1-dev.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RELEASE-NOTES-4.1-dev.txt	5 Jan 2002 22:40:23 -0000	1.2
  +++ RELEASE-NOTES-4.1-dev.txt	28 Feb 2002 17:20:56 -0000	1.3
  @@ -3,7 +3,7 @@
                               Release Notes
                               =============
   
  -$Id: RELEASE-NOTES-4.1-dev.txt,v 1.2 2002/01/05 22:40:23 larryi Exp $
  +$Id: RELEASE-NOTES-4.1-dev.txt,v 1.3 2002/02/28 17:20:56 glenn Exp $
   
   
   ============
  @@ -39,6 +39,9 @@
   Catalina New Features:
   ---------------------
   
  +Added the workDir attribute to the Host configuration in server.xml.
  +This makes it easier to configure a different location for each
  +virtual hosts application work directories.
   
   -------------------
   Jasper New Features:
  @@ -48,6 +51,11 @@
   --------------------
   Webapps New Features:
   --------------------
  +
  +The default work directory created for a web application now includes the
  +Engine name as a directory in work directory path name.  This ensures that
  +if you have two Host's with the same host name (one http, one https) configured
  +in different Engine's, they will each have their own unique work directory.
   
   
   ==========================
  
  
  
  1.5       +16 -0     jakarta-tomcat-4.0/catalina/docs/config/host.html
  
  Index: host.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/config/host.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- host.html	21 Mar 2001 01:59:19 -0000	1.4
  +++ host.html	28 Feb 2002 17:20:56 -0000	1.5
  @@ -88,6 +88,22 @@
       </td>
     </tr>
   
  +  <tr>
  +    <td><code>workDir</code></td>
  +    <td>
  +      Pathname to a scratch directory to be used by applications for 
  +      this Host. Each application will have its own sub directory with
  +      temporary read-write use.  Configuring a Context workDir will override
  +      use of the Host workDir configuration.  The
  +      corresponding directory will be made visible as a servlet context
  +      attribute (of type <code>java.io.File</code>) with the standard name
  +      assigned by the Servlet API Specification, version 2.2
  +      (<code>javax.servlet.context.tempdir</code>).  If not specified, a
  +      suitable directory underneath Catalina's home directory will be
  +      assigned automatically.
  +    </td>
  +  </tr>
  +
   </table>
   
   <br>
  
  
  
  1.100     +29 -13    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.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- StandardContext.java	27 Feb 2002 02:34:54 -0000	1.99
  +++ StandardContext.java	28 Feb 2002 17:20:56 -0000	1.100
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v 1.99 2002/02/27 02:34:54 remm Exp $
  - * $Revision: 1.99 $
  - * $Date: 2002/02/27 02:34:54 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v 1.100 2002/02/28 17:20:56 glenn Exp $
  + * $Revision: 1.100 $
  + * $Date: 2002/02/28 17:20:56 $
    *
    * ====================================================================
    *
  @@ -147,7 +147,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.99 $ $Date: 2002/02/27 02:34:54 $
  + * @version $Revision: 1.100 $ $Date: 2002/02/28 17:20:56 $
    */
   
   public class StandardContext
  @@ -3829,16 +3829,28 @@
        */
       private void postWorkDirectory() {
   
  -        // Retrieve our parent (normally a host) name
  -        String parentName = null;
  -        if (getParent() != null)
  -            parentName = getParent().getName();
  -        if ((parentName == null) || (parentName.length() < 1))
  -            parentName = "_";
  -
           // Acquire (or calculate) the work directory path
           String workDir = getWorkDir();
           if (workDir == null) {
  +
  +            // Retrieve our parent (normally a host) name
  +            String hostName = null;
  +            String engineName = null;
  +            String hostWorkDir = null;
  +            Container parentHost = getParent();
  +            if (parentHost != null) {
  +                hostName = parentHost.getName();
  +                hostWorkDir = ((StandardHost)parentHost).getWorkDir();
  +                Container parentEngine = parentHost.getParent();
  +                if (parentEngine != null) {
  +                   engineName = parentEngine.getName();
  +                }
  +            }
  +            if ((hostName == null) || (hostName.length() < 1))
  +                hostName = "_";
  +            if ((engineName == null) || (engineName.length() < 1))
  +                engineName = "_";
  +
               String temp = getPath();
               if (temp.startsWith("/"))
                   temp = temp.substring(1);
  @@ -3846,8 +3858,12 @@
               temp = temp.replace('\\', '_');
               if (temp.length() < 1)
                   temp = "_";
  -            workDir = "work" + File.separator + parentName +
  -                File.separator + temp;
  +            if (hostWorkDir != null ) {
  +                workDir = hostWorkDir + File.separator + temp;
  +            } else {
  +                workDir = "work" + File.separator + engineName +
  +                    File.separator + hostName + File.separator + temp;
  +            }
               setWorkDir(workDir);
           }
   
  
  
  
  1.24      +28 -4     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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- StandardHost.java	9 Dec 2001 22:03:11 -0000	1.23
  +++ StandardHost.java	28 Feb 2002 17:20:56 -0000	1.24
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v 1.23 2001/12/09 22:03:11 remm Exp $
  - * $Revision: 1.23 $
  - * $Date: 2001/12/09 22:03:11 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v 1.24 2002/02/28 17:20:56 glenn Exp $
  + * $Revision: 1.24 $
  + * $Date: 2002/02/28 17:20:56 $
    *
    * ====================================================================
    *
  @@ -95,7 +95,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.23 $ $Date: 2001/12/09 22:03:11 $
  + * @version $Revision: 1.24 $ $Date: 2002/02/28 17:20:56 $
    */
   
   public class StandardHost
  @@ -190,6 +190,12 @@
   
   
       /**
  +     * Work Directory base for applications.
  +     */
  +    private String workDir = null;
  +
  +
  +    /**
        * DefaultContext config
        */
       private DefaultContext defaultContext;
  @@ -425,6 +431,24 @@
   
           this.unpackWARs = unpackWARs;
   
  +    }
  +
  +
  +    /**
  +     * Host work directory base.
  +     */
  +    public String getWorkDir() {
  +
  +        return (workDir);
  +    }
  +
  +
  +    /**
  +     * Host work directory base.
  +     */
  +    public void setWorkDir(String workDir) {
  +
  +        this.workDir = workDir;
       }
   
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>