commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jharrop <ja...@plutext.org>
Subject Re: [vfs] webdav, jackrabbit and fileObject.exists()
Date Fri, 18 Apr 2008 01:41:42 GMT

Hi Stephan

See http://issues.apache.org/jira/browse/VFS-207 for a patch, now 9 days
old.

Hopefully that fix works for jackrabbit's WebDAV.  

I'm considering adding the vfs webdav sandbox stuff to webdavclient4j's
source tree, and maintaining it there.  

cheers,

Jason


Stephan Schuster-3 wrote:
> 
> hi together,
> 
> first of all thanks for this great piece of software!
> 
> 
> my context:
> i want to use vfs to search and - if existing - access files on my 
> server via webdav. as stated on the homepage i use:
> commons-httpclient-2.0.2.jar
> commons-logging-1.1.1.jar
> commons-vfs-sandbox-1.0-SNAPSHOT.jar
> jakarta-slide-webdavlib-20050629.161100.jar
> jdom-1.0.jar
> 
> my problem:
> - my little test program (see below) WORKS fine IF THE FILE i want to 
> resolve EXISTS on the server (APACHE or JACKRABBIT deployed in tomcat).
> - IF THE FILE DOES NOT EXIST
>    - it IS STILL WORKING on APACHE as my weddav server.
>    - it DOES NOT WORK on JACKRABBIT as my server. see exception below.
> 
> the reason:
> in WebdavFileObject.setDavResource(WebdavResource resource) the server 
> is asked via the OptionsMethod which methods it understands for the 
> encoded path of a potentially non existing file. i setup a proxy in 
> between. see the complete results at the end of my mail.
> 
> apache returns: OPTIONS,MKCOL,PUT,LOCK
> jackrabbit returns: OPTIONS, GET, HEAD, POST, TRACE, PROPFIND, 
> PROPPATCH, MKCOL, COPY, PUT, DELETE, MOVE, LOCK, UNLOCK, VERSION-CONTROL
> 
> WebdavFileObject traverses each returned method and if it encounters 
> "COPY" it assumes that the file exists. however, this is not true for 
> jackrabbit.
> 
> 
> now, which code is wrong? the one of jackrabbit (i looked into it but 
> couldn't find the right place) or the one of vfs. is there a workaround 
> or something else i can do?
> 
> 
> thanks,
> stephan
> 
> 
> TEST PROGRAM:
> 
> DefaultFileSystemManager mgr = new DefaultFileSystemManager();
> mgr.addProvider("file", new DefaultLocalFileProvider());
> mgr.addProvider("webdav", new WebdavFileProvider());
> mgr.init();
> 
> FileObject file = mgr.resolveFile(PATH-TO-NON-EXISTING-FILE-ON-SERVER);
> 
> if (file.exists()) { // THAT'S WHERE THE EXCEPTION OCCURS!!!
>     ...
> }
> ...
> 
> 
> EXCEPTION:
> 
> org.apache.commons.vfs.FileSystemException: Could not determine the type 
> of file 
> "webdav://username:password@localhost:8888/jackrabbit/repository/default/test/non-existing-file.txt".
> 	at 
> org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:1305)
> 	at 
> org.apache.commons.vfs.provider.AbstractFileObject.getType(AbstractFileObject.java:412)
> 	at 
> org.apache.commons.vfs.provider.AbstractFileObject.exists(AbstractFileObject.java:402)
> 	at test.Main2.main(Main2.java:42)
> Caused by: org.apache.commons.vfs.FileSystemException
> 	at 
> org.apache.commons.vfs.provider.webdav.WebdavFileObject.setDavResource(WebdavFileObject.java:190)
> 	at 
> org.apache.commons.vfs.provider.webdav.WebdavFileObject.doAttach(WebdavFileObject.java:92)
> 	at 
> org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:1291)
> 	... 3 more
> Caused by: org.apache.commons.httpclient.HttpException
> 	at 
> org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3517)
> 	at 
> org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3472)
> 	at 
> org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:976)
> 	at 
> org.apache.webdav.lib.WebdavResource.setDefaultProperties(WebdavResource.java:963)
> 	at 
> org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1923)
> 	at 
> org.apache.commons.vfs.provider.webdav.WebdavFileObject.setDavResource(WebdavFileObject.java:186)
> 	... 5 more
> 
> 
> PROXY OUTPUT JACKRABBIT:
> 
> 
> REQUEST:
> 
> OPTIONS /jackrabbit/repository/default/test/file3.txt HTTP/1.1
> Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
> User-Agent: Jakarta Commons-HttpClient/2.0.2
> Host: 127.0.0.1:8000
> 
> PROPFIND /jackrabbit/repository/default/test/file3.txt HTTP/1.1
> Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
> Content-Type: text/xml; charset=utf-8
> User-Agent: Jakarta Commons-HttpClient/2.0.2
> Host: localhost:8000
> Content-Length: 288
> Depth: 1
> 
> <?xml version="1.0" encoding="utf-8" ?><D:propfind 
> xmlns:D="DAV:"><D:prop><D:creationdate/><D:displayname/><D:getcontentlanguage/><D:getcontentlength/><D:getcontenttype/><D:getetag/><D:getlastmodified/><D:lockdiscovery/><D:resourcetype/><D:source/><D:supportedlock/></D:prop></D:propfind>
> 
> 
> RESPONSE:
> 
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> DAV: 1,2,version-control,version-history,label
> Allow: OPTIONS, GET, HEAD, POST, TRACE, PROPFIND, PROPPATCH, MKCOL, 
> COPY, PUT, DELETE, MOVE, LOCK, UNLOCK, VERSION-CONTROL
> MS-Author-Via: DAV
> Content-Length: 0
> Date: Tue, 01 Apr 2008 10:05:39 GMT
> 
> HTTP/1.1 404 Not Found
> Server: Apache-Coyote/1.1
> Content-Type: text/html;charset=utf-8
> Content-Length: 952
> Date: Tue, 01 Apr 2008 10:05:39 GMT
> 
> <html><head><title>Apache Tomcat/5.5.17 - Error 
> report</title><style><!--H1 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}

> H2 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}

> H3 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}

> BODY 
> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} 
> B 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} 
> P 
> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A 
> {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> 
> </head><body><h1>HTTP Status 404 - </h1><HR size="1" 
> noshade="noshade"><p>type Status report</p><p>message 
> <u></u></p><p>description <u>The requested resource ()
is not 
> available.</u></p><HR size="1" noshade="noshade"><h3>Apache 
> Tomcat/5.5.17</h3></body></html>
> 
> 
> PROXY OUTPUT APACHE:
> 
> 
> REQUEST:
> 
> OPTIONS /webdav/test/file3.txt HTTP/1.1
> Authorization: Basic d2lsa2VuOndpbGtlbg==
> User-Agent: Jakarta Commons-HttpClient/2.0.2
> Host: 127.0.0.1:8888
> 
> 
> RESPONSE:
> 
> HTTP/1.1 200 OK
> Date: Tue, 01 Apr 2008 09:49:13 GMT
> Server: Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g 
> mod_autoindex_color PHP/5.2.5
> DAV: 1,2
> MS-Author-Via: DAV
> Allow: OPTIONS,MKCOL,PUT,LOCK
> Content-Length: 0
> Content-Type: text/plain
> X-Pad: avoid browser bug
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-vfs--webdav%2C-jackrabbit-and-fileObject.exists%28%29-tp16419233p16758769.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message