cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/webapp/WEB-INF web.xml
Date Sat, 21 Sep 2002 15:07:57 GMT
vgritsenko    2002/09/21 08:07:57

  Modified:    .        changes.xml
               src/java/org/apache/cocoon/servlet CocoonServlet.java
               src/webapp/WEB-INF web.xml
  Log:
  Fix bug 12131: Make directory settings consistent, document changes in web.xml and change
log.
  
  Revision  Changes    Path
  1.254     +5 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.253
  retrieving revision 1.254
  diff -u -r1.253 -r1.254
  --- changes.xml	20 Sep 2002 23:06:01 -0000	1.253
  +++ changes.xml	21 Sep 2002 15:07:56 -0000	1.254
  @@ -40,6 +40,10 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="VG" type="update" fixes-bug="12131">
  +    Absolute path now can be specified for work, cache, and upload directory.
  +    Read comments in web.xml, and verify your settings.
  +  </action>
     <action dev="KP" type="add">
       Added JXPath based input modules for Request and Session properties.
       Demonstration sample is also added.
  
  
  
  1.37      +28 -19    xml-cocoon2/src/java/org/apache/cocoon/servlet/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/servlet/CocoonServlet.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- CocoonServlet.java	21 Sep 2002 02:28:29 -0000	1.36
  +++ CocoonServlet.java	21 Sep 2002 15:07:56 -0000	1.37
  @@ -262,12 +262,11 @@
                       this.workDir = new File(servletContextPath , workDirParam);
                   }
               }
  -            this.workDir.mkdirs();
           } else {
               this.workDir = (File) this.servletContext.getAttribute("javax.servlet.context.tempdir");
               this.workDir = new File(workDir, "cocoon-files");
  -            this.workDir.mkdirs();
           }
  +        this.workDir.mkdirs();
   
           this.initLogger();
           String path = this.servletContextPath;
  @@ -322,7 +321,7 @@
           // add work directory
           if ((workDirParam != null) && (!workDirParam.trim().equals(""))) {
               if (log.isDebugEnabled()) {
  -                log.debug("using work-directory " + this.workDir);
  +                log.debug("Using work-directory " + this.workDir);
               }
           } else {
               if (log.isDebugEnabled()) {
  @@ -336,21 +335,27 @@
               if (this.servletContextPath == null) {
                   this.uploadDir = new File(uploadDirParam);
               } else {
  -                this.uploadDir = IOUtils.createFile( new File(servletContextPath) , uploadDirParam);
  +                // Context path exists : is work-directory absolute ?
  +                File uploadDirParamFile = new File(uploadDirParam);
  +                if (uploadDirParamFile.isAbsolute()) {
  +                    // Yes : keep it as is
  +                    this.uploadDir = uploadDirParamFile;
  +                } else {
  +                    // No : consider it relative to context path
  +                    this.uploadDir = new File(servletContextPath , uploadDirParam);
  +                }
               }
  -            this.uploadDir.mkdirs();
               if (log.isDebugEnabled()) {
  -                log.debug("using upload-directory " + this.uploadDir);
  +                log.debug("Using upload-directory " + this.uploadDir);
               }
  -        } else        {
  -            this.uploadDir = IOUtils.createFile(workDir, "upload-dir" + File.separator);
  +        } else {
  +            this.uploadDir = new File(workDir, "upload-dir" + File.separator);
               if (log.isDebugEnabled()) {
                   log.debug("upload-directory was not set - defaulting to " + this.uploadDir);
               }
           }
  -
  -        this.appContext.put(Constants.CONTEXT_UPLOAD_DIR, this.uploadDir);
           this.uploadDir.mkdirs();
  +        this.appContext.put(Constants.CONTEXT_UPLOAD_DIR, this.uploadDir);
   
           String maxSizeParam = conf.getInitParameter("upload-max-size");
           if ((maxSizeParam != null) && (!maxSizeParam.trim().equals(""))) {
  @@ -362,21 +367,27 @@
               if (this.servletContextPath == null) {
                   this.cacheDir = new File(cacheDirParam);
               } else {
  -                this.cacheDir = IOUtils.createFile( new File(servletContextPath) , cacheDirParam);
  +                // Context path exists : is work-directory absolute ?
  +                File cacheDirParamFile = new File(cacheDirParam);
  +                if (cacheDirParamFile.isAbsolute()) {
  +                    // Yes : keep it as is
  +                    this.cacheDir = cacheDirParamFile;
  +                } else {
  +                    // No : consider it relative to context path
  +                    this.cacheDir = new File(servletContextPath , cacheDirParam);
  +                }
               }
  -            this.cacheDir.mkdirs();
               if (log.isDebugEnabled()) {
  -                log.debug("using cache-directory " + this.cacheDir);
  +                log.debug("Using cache-directory " + this.cacheDir);
               }
  -        } else        {
  +        } else {
               this.cacheDir = IOUtils.createFile(workDir, "cache-dir" + File.separator);
               if (log.isDebugEnabled()) {
                   log.debug("cache-directory was not set - defaulting to " + this.cacheDir);
               }
           }
  -
  -        this.appContext.put(Constants.CONTEXT_CACHE_DIR, this.cacheDir);
           this.cacheDir.mkdirs();
  +        this.appContext.put(Constants.CONTEXT_CACHE_DIR, this.cacheDir);
   
           this.appContext.put(Constants.CONTEXT_CONFIG_URL,
                               this.getConfigFile(conf.getInitParameter("configurations")));
  @@ -887,7 +898,6 @@
                       continue;
                   }
                   try {
  -
                       String key = property.substring(0,property.indexOf('='));
                       String value = property.substring(property.indexOf('=') + 1);
                       if (value.indexOf("${") != -1) {
  @@ -1141,7 +1151,6 @@
               } catch(Exception e) {
                     log.error("Cocoon servlet threw an Exception while trying to close stream.",
e);
               }
  -
           }
       }
   
  
  
  
  1.19      +19 -12    xml-cocoon2/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/web.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- web.xml	16 Sep 2002 14:05:48 -0000	1.18
  +++ web.xml	21 Sep 2002 15:07:57 -0000	1.19
  @@ -125,38 +125,45 @@
       </init-param>
   
       <!--
  -      This parameter allows to specify where Cocoon should put files
  -      which are uploaded by the upload.xsp sample. The path specified
  -      is always relative to the context path of the servlet.
  +      This parameter allows to specify where Cocoon should put uploaded files.
  +      The path specified can be either absolute or relative to the context 
  +      path of the servlet. On windows platform, absolute directory must start
  +      with volume: C:\Path\To\Upload\Directory
  +
         The default directory is "upload-dir" in the work-directory
   
       <init-param>
         <param-name>upload-directory</param-name>
  -      <param-value>/WEB-INF/work/upload-dir</param-value>
  +      <param-value>WEB-INF/work/upload-dir</param-value>
       </init-param>
       -->
   
       <!--
  -      This parameter allows to specify where Cocoon should put files
  -      which are cached by the storing class. The path specified
  -      is always relative to the context path of the servlet.
  +      This parameter allows to specify where Cocoon should create its page
  +      and other objects cache. The path specified can be either absolute or
  +      relative to the context path of the servlet. On windows platform,
  +      absolute directory must start with volume: C:\Path\To\Cache\Directory
  +      
         The default directory is "cache-dir" in the work-directory
   
       <init-param>
         <param-name>cache-directory</param-name>
  -      <param-value>/WEB-INF/work/cache-dir</param-value>
  +      <param-value>WEB-INF/work/cache-dir</param-value>
       </init-param>
       -->
   
       <!--
         This parameter allows to specify where Cocoon should put it's
  -      working files. The path specified is always relative to the
  -      context path of the Cocoon servlet.
  -      Usually it is obtained from the servlet engine.
  +      working files. The path specified is either absolute or relative
  +      to the context path of the Cocoon servlet.  On windows platform,
  +      absolute directory must start with volume: C:\Path\To\Work\Directory
  +
  +      The default directory is "cocoon-files" directory in the servlet
  +      context's temp directory (context property javax.servlet.context.tempdir).
   
       <init-param>
         <param-name>work-directory</param-name>
  -      <param-value>/WEB-INF/work</param-value>
  +      <param-value>WEB-INF/work</param-value>
       </init-param>
       -->
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message