roku 2004/04/12 04:36:43
Modified: src/blocks/webdav/java/org/apache/cocoon/components/webdav
WebDAVUtil.java
Log:
Integrated support for session independent locks.
See http://issues.apache.org/bugzilla/show_bug.cgi?id=28311
Revision Changes Path
1.6 +12 -8
cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/webdav/WebDAVUtil.java
Index: WebDAVUtil.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/webdav/WebDAVUtil.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WebDAVUtil.java 8 Apr 2004 13:03:50 -0000 1.5
+++ WebDAVUtil.java 12 Apr 2004 11:36:43 -0000 1.6
@@ -52,10 +52,14 @@
throws HttpException, IOException {
if (uri == null) return null;
- if (uri.equals(staticURI)) return staticResource;
+ if (uri.equals(staticURI)) {
+ staticResource.discoverOwnLocks();
+ return staticResource;
+ }
HttpURL sourceURL = new HttpURL(uri);
staticURI = uri;
staticResource = new WebdavResource(sourceURL);
+ staticResource.discoverOwnLocks();
return staticResource;
}
@@ -68,15 +72,15 @@
* @throws IOException
* @return Success
*/
- static public void createResource(String uri, String content)
+ static public void createResource(final String uri, final String content)
throws HttpException, IOException {
- HttpURL sourceURL = new HttpURL(uri);
- final WebdavResource resource = new WebdavResource(sourceURL,
-
WebdavResource.NOACTION,
-
WebdavResource.getDefaultDepth());
-
- if(!resource.putMethod(content)) {
+ final String filename = uri.substring(uri.lastIndexOf("/"));
+ final String uriPrefix = uri.substring(0, uri.lastIndexOf("/"));
+ final HttpURL sourceURL = new HttpURL(uri);
+ final WebdavResource resource = getWebdavResource(uriPrefix);
+
+ if(!resource.putMethod(uriPrefix + filename, content)) {
throw new HttpException("Error creating resource: " + uri
+ " Status: " + resource.getStatusCode()
+ " Message: " +
resource.getStatusMessage());