glenn       02/03/02 10:00:13

  Modified:    webapps/tomcat-docs/config Tag: tomcat_40_branch host.xml
               catalina/src/share/org/apache/catalina/core Tag:
                        tomcat_40_branch StandardContext.java
                        StandardHost.java
               .        Tag: tomcat_40_branch RELEASE-NOTES-4.0.4-B1.txt
  Log:
  Port the SRV.3.7.1 compliance bug fix into the release branch.
  
  This fixes a spec compliance bug, SRV.3.7.1 states that the
  tempdir for a Servlet Context must be unique.
  
  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
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.4   +12 -0     jakarta-tomcat-4.0/webapps/tomcat-docs/config/host.xml
  
  Index: host.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/config/host.xml,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- host.xml  12 Oct 2001 17:10:52 -0000      1.2.2.3
  +++ host.xml  2 Mar 2002 18:00:12 -0000       1.2.2.4
  @@ -114,6 +114,18 @@
           <code>false</code> to run the application directly from a WAR file.</p>
         </attribute>
   
  +      <attribute name="workDir" required="false">
  +        <p>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.  This directory will be made
  +        visible to servlets in the web application by a servlet context
  +        attribute (of type <code>java.io.File</code>) named
  +        <code>javax.servlet.context.tempdir</code> as described in the
  +        Servlet Specification.  If not specified, a suitable directory
  +        underneath <code>$CATALINA_HOME/work</code> will be provided.</p>
  +      </attribute>
  +
       </attributes>
   
     </subsection>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.78.2.14 +31 -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.78.2.13
  retrieving revision 1.78.2.14
  diff -u -r1.78.2.13 -r1.78.2.14
  --- StandardContext.java      27 Feb 2002 02:56:18 -0000      1.78.2.13
  +++ StandardContext.java      2 Mar 2002 18:00:12 -0000       1.78.2.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
 1.78.2.13 2002/02/27 02:56:18 remm Exp $
  - * $Revision: 1.78.2.13 $
  - * $Date: 2002/02/27 02:56:18 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
 1.78.2.14 2002/03/02 18:00:12 glenn Exp $
  + * $Revision: 1.78.2.14 $
  + * $Date: 2002/03/02 18:00:12 $
    *
    * ====================================================================
    *
  @@ -143,7 +143,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.78.2.13 $ $Date: 2002/02/27 02:56:18 $
  + * @version $Revision: 1.78.2.14 $ $Date: 2002/03/02 18:00:12 $
    */
   
   public class StandardContext
  @@ -3917,16 +3917,30 @@
        */
       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();
  +                if (parentHost instanceof StandardHost) {
  +                    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);
  @@ -3934,8 +3948,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.18.2.4  +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.18.2.3
  retrieving revision 1.18.2.4
  diff -u -r1.18.2.3 -r1.18.2.4
  --- StandardHost.java 27 Jan 2002 21:13:15 -0000      1.18.2.3
  +++ StandardHost.java 2 Mar 2002 18:00:12 -0000       1.18.2.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
 1.18.2.3 2002/01/27 21:13:15 remm Exp $
  - * $Revision: 1.18.2.3 $
  - * $Date: 2002/01/27 21:13:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
 1.18.2.4 2002/03/02 18:00:12 glenn Exp $
  + * $Revision: 1.18.2.4 $
  + * $Date: 2002/03/02 18:00:12 $
    *
    * ====================================================================
    *
  @@ -103,7 +103,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.18.2.3 $ $Date: 2002/01/27 21:13:15 $
  + * @version $Revision: 1.18.2.4 $ $Date: 2002/03/02 18:00:12 $
    */
   
   public class StandardHost
  @@ -185,6 +185,12 @@
   
   
       /**
  +     * Work Directory base for applications.
  +     */
  +    private String workDir = null;
  +
  +
  +    /**
        * DefaultContext config
        */
       private DefaultContext defaultContext;
  @@ -393,6 +399,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;
       }
   
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +13 -1     jakarta-tomcat-4.0/Attic/RELEASE-NOTES-4.0.4-B1.txt
  
  Index: RELEASE-NOTES-4.0.4-B1.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/Attic/RELEASE-NOTES-4.0.4-B1.txt,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- RELEASE-NOTES-4.0.4-B1.txt        2 Mar 2002 04:20:13 -0000       1.1.2.1
  +++ RELEASE-NOTES-4.0.4-B1.txt        2 Mar 2002 18:00:13 -0000       1.1.2.2
  @@ -3,7 +3,7 @@
                               Release Notes
                               =============
   
  -$Id: RELEASE-NOTES-4.0.4-B1.txt,v 1.1.2.1 2002/03/02 04:20:13 remm Exp $
  +$Id: RELEASE-NOTES-4.0.4-B1.txt,v 1.1.2.2 2002/03/02 18:00:13 glenn Exp $
   
   
   ============
  @@ -46,6 +46,9 @@
   
   BaseDirContext:  Add lifecycle management, to allow releasing used resources.
   
  +StandardHost: Added the workDir attribute to the Host configuration.
  +  This makes it easier to set the base directory where the work directories for
  +  application Context's are placed when virtual hosting sites with Tomcat.
   
   -------------------
   Jasper New Features:
  @@ -94,6 +97,15 @@
     resources from outside the Catalina home directory, using the request
     dispatcher. This also implements the specification requirement that the 
     request dispatcher cannot extend outside the current servlet context.
  +
  +
  +ServletContext tempdir (workDir):  Fixed a spec compliance bug, SRV.3.7.1
  +  states that the tempdir for a Servlet Context must be unique.
  +  
  +  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.
   
   
   ----------------
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to