vgritsenko 2002/09/21 08:06:44
Modified: . Tag: cocoon_2_0_3_branch changes.xml
src/java/org/apache/cocoon/servlet Tag: cocoon_2_0_3_branch
CocoonServlet.java
src/webapp/WEB-INF Tag: cocoon_2_0_3_branch web.xml
Log:
Fix bug 12131: Make directory settings consistent, document changes in web.xml and
change log.
Revision Changes Path
No revision
No revision
1.138.2.53 +5 -2 xml-cocoon2/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/changes.xml,v
retrieving revision 1.138.2.52
retrieving revision 1.138.2.53
diff -u -r1.138.2.52 -r1.138.2.53
--- changes.xml 21 Sep 2002 04:03:50 -0000 1.138.2.52
+++ changes.xml 21 Sep 2002 15:06:43 -0000 1.138.2.53
@@ -39,6 +39,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="VG" type="fix" fixes-bug="12328">
Set URI resolver for XSLT handler every time time templates are used,
because XSLT templates might reference disposed instance of XSLT processor.
@@ -1227,5 +1231,4 @@
Initial code implementation.
</action>
</release>
-
</changes>
No revision
No revision
1.19.2.11 +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.19.2.10
retrieving revision 1.19.2.11
diff -u -r1.19.2.10 -r1.19.2.11
--- CocoonServlet.java 21 Sep 2002 02:28:29 -0000 1.19.2.10
+++ CocoonServlet.java 21 Sep 2002 15:06:44 -0000 1.19.2.11
@@ -253,12 +253,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;
@@ -313,7 +312,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()) {
@@ -327,21 +326,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(""))) {
@@ -353,21 +358,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")));
@@ -869,7 +880,6 @@
continue;
}
try {
-
String key = property.substring(0,property.indexOf('='));
String value = property.substring(property.indexOf('=') + 1);
if (value.indexOf("${") != -1) {
@@ -1123,7 +1133,6 @@
} catch(Exception e) {
log.error("Cocoon servlet threw an Exception while trying to close
stream.", e);
}
-
}
}
No revision
No revision
1.8.2.4 +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.8.2.3
retrieving revision 1.8.2.4
diff -u -r1.8.2.3 -r1.8.2.4
--- web.xml 11 Jun 2002 13:45:37 -0000 1.8.2.3
+++ web.xml 21 Sep 2002 15:06:44 -0000 1.8.2.4
@@ -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: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]