unico 2004/01/16 09:54:12
Modified: src/blocks/webdav/java/org/apache/cocoon/components/source/impl
WebDAVSource.java
Log:
make constant fields static;
change getContentLength behavior when dealing with a collection because
the actual content length returned by the webdav source in case of a
collectoin is not 0
since an xml representation is generated in that case.
Returning -1 solves a problem with sitemap components that return false to
shouldSetContentLength()
Revision Changes Path
1.19 +23 -20
cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java
Index: WebDAVSource.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- WebDAVSource.java 15 Jan 2004 13:31:08 -0000 1.18
+++ WebDAVSource.java 16 Jan 2004 17:54:12 -0000 1.19
@@ -111,14 +111,18 @@
RestrictableSource, ModifiableTraversableSource, InspectableSource {
- private final String NAMESPACE = "http://apache.org/cocoon/webdav/1.0";
+ private static final String NAMESPACE =
"http://apache.org/cocoon/webdav/1.0";
- private final String PREFIX = "webdav";
+ private static final String PREFIX = "webdav";
- private final String RESOURCE_NAME = "resource";
+ private static final String RESOURCE_NAME = "resource";
- private final String COLLECTION_NAME = "collection";
+ private static final String COLLECTION_NAME = "collection";
+ static {
+ WebdavResource.setGetUseDisk(false);
+ }
+
private String systemId;
private String location;
@@ -147,21 +151,17 @@
this.systemId = "http://" + location;
- //try {
- HttpURL httpURL = new HttpURL(this.systemId);
- httpURL.setUserInfo(principal, password);
-
- if (createNew)
- this.resource = new WebdavResource(httpURL,
- WebdavResource.NOACTION,
- DepthSupport.DEPTH_1);
- else
- this.resource = new WebdavResource(httpURL);
-
- WebdavResource.setGetUseDisk(false);
- //} catch (IOException ioe) {
- // throw new IllegalStateException(ioe.getMessage());
- //}
+ HttpURL httpURL = new HttpURL(this.systemId);
+ httpURL.setUserInfo(principal, password);
+
+ if (createNew) {
+ this.resource = new WebdavResource(httpURL,
+ WebdavResource.NOACTION,
+ DepthSupport.DEPTH_1);
+ }
+ else {
+ this.resource = new WebdavResource(httpURL);
+ }
}
@@ -333,6 +333,9 @@
* unknown
*/
public long getContentLength() {
+ if (this.resource.isCollection()) {
+ return -1;
+ }
return this.resource.getGetContentLength();
}