You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Stephan Schuster <st...@wilken.de> on 2008/04/01 12:29:39 UTC

[vfs] webdav, jackrabbit and fileObject.exists()

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><b>type</b> Status report</p><p><b>message</b> 
<u></u></p><p><b>description</b> <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


Re: [vfs] webdav, jackrabbit and fileObject.exists()

Posted by Stephan Schuster <st...@wilken.de>.
hi jason,

wow, that is pretty good news! thank you for the effort. i'll try it 
either today or tomorrow. yippie!

best regards,
stephan



jharrop wrote:
> Hi Stephan
> 
> I've now included the WebDAV provider in the webdavclient4j source tree,
> with this patch.
> 
> The webdavclient4j 0.91 distribution includes a commons-vfs jar which
> supports HttpClient 3.0.1 (ie VFS-74 applied).
> 
> The intention is that the webdavclient4j distribution is all you need in
> order to be up and running.  It also works nicely with VfsJFileChooser.
> 
> cheers
> 
> Jason

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


Re: [vfs] webdav, jackrabbit and fileObject.exists()

Posted by jharrop <ja...@plutext.org>.
Hi Stephan

I've now included the WebDAV provider in the webdavclient4j source tree,
with this patch.

The webdavclient4j 0.91 distribution includes a commons-vfs jar which
supports HttpClient 3.0.1 (ie VFS-74 applied).

The intention is that the webdavclient4j distribution is all you need in
order to be up and running.  It also works nicely with VfsJFileChooser.

cheers

Jason



Stephan Schuster-3 wrote:
> 
> hi jason,
> 
> thanks again for all the information.
> 
> i'll keep watching wedavclient4j very closely.
> 
> 
> good luck,
> stephan
> 
> ---------------------------------------------------------------------
> 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-tp16419233p16835547.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


Re: [vfs] webdav, jackrabbit and fileObject.exists()

Posted by Stephan Schuster <st...@wilken.de>.
hi jason,

thanks again for all the information.

i'll keep watching wedavclient4j very closely.


good luck,
stephan

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


Re: [vfs] webdav, jackrabbit and fileObject.exists()

Posted by jharrop <ja...@plutext.org>.
Hi Stephan


Stephan Schuster-3 wrote:
> 
> what i'm way more interested in is an "active" client side webdav 
> library for java (since slide has retired). in fact i hope that such a 
> library will soon get integrated into VFS (which i use heavily for my 
> current project) so that there is no need for a sandbox that depends on 
> a snapshot of a dead project.
> 

That is essentially my need as well.   

But if that doesn't happen - and according to the Apache Commons Board
Report of Dec 2007, it was rejected as out of scope [1] - an alternative is
to include VFS as part of webdavclient4j.

I would be quite happy if apache started a new webdav client project (based
on the Slide code).  Webdavclient4j only exists because apache does not
(yet) have such a plan.  Maybe this will change soon, in which case
webdavclient4j might not be necessary;  maybe webdavclient4j will mature
itself and ultimately become a formal part of the apache family.


Stephan Schuster-3 wrote:
> 
> do you think there is a chance that your webdavclient4j will be used by 
> vfs?

Possibly, that's a decision the vfs devs will need to make.  I guess if
webdavclient4j is a live project (ie comes to have an active community of
developers working on it), and is available via maven, there would be no
reason not to use it in preference to a snapshot of a dead project.


Stephan Schuster-3 wrote:
> 
>  by the way: do you know if slide is the only reason why vfs depends 
> on httpclient 2.0.2?
> 

I think so - you can apply the patch in VFS-74 to use httpclient 3.0.1. [2]


Stephan Schuster-3 wrote:
> 
>  as far as i remember your webdavclient4j client 
> already supports httpclient 3.0.1 (what about 3.1). so if vfs will use 
> your client there might be a chance to migrate to 3.xxx - that would be 
> really great!
> 

In fact vfs Revision 209275 was compatible with HttpClient 3.0.1.  Revision
209411 reverted back to HttpClient 2.0.2 on the basis that HttpClient
3.0-rc3 and WebDavLib were not compatible, which was the case at the time
(July 2005), but ceased being the case in Dec 2006 - see
https://issues.apache.org/bugzilla/show_bug.cgi?id=35213

So if vfs was using a Slide client build from after that date (or
webdavclient4j), they could use HttpClient 3.0.1.


Stephan Schuster-3 wrote:
> 
> ps: if i had more time at the moment i would even consider helping 
> you... maybe later.
> 

Well, if you run into any problems with webdavclient4j, you may want to step
up to the plate :)

An active community around the project would demonstrate that there are
developers who are prepared to work on a webdav client.

cheers,

Jason

[1]
http://www.nabble.com/Apache-Commons-Board-Report%2C-December-2007-td14361386.html#a14361386
[2] https://issues.apache.org/jira/browse/VFS-74
-- 
View this message in context: http://www.nabble.com/-vfs--webdav%2C-jackrabbit-and-fileObject.exists%28%29-tp16419233p16769705.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


Re: [vfs] webdav, jackrabbit and fileObject.exists()

Posted by Stephan Schuster <st...@wilken.de>.
hi jason,

thank you for your effort, i'll try your patch soon. for the moment i'm 
not really dependent on jackrabbit, a plain apache or even tomcat with 
webdav support is fine.

what i'm way more interested in is an "active" client side webdav 
library for java (since slide has retired). in fact i hope that such a 
library will soon get integrated into VFS (which i use heavily for my 
current project) so that there is no need for a sandbox that depends on 
a snapshot of a dead project. i followed your discussion "the state of 
webdav clients" and i'm quite happy that finally someone attends to this 
problem.

do you think there is a chance that your webdavclient4j will be used by 
vfs? by the way: do you know if slide is the only reason why vfs depends 
on httpclient 2.0.2? as far as i remember your webdavclient4j client 
already supports httpclient 3.0.1 (what about 3.1). so if vfs will use 
your client there might be a chance to migrate to 3.xxx - that would be 
really great!


keep on the good work!

regards,
stephan


ps: if i had more time at the moment i would even consider helping 
you... maybe later.




jharrop wrote:
> 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
>>
>>
>>
> 
X-AntiVirus: checked by AntiVir MailGuard (Version: 8.0.0.18; AVE: 8.1.0.30; VDF: 7.0.3.183)

-- 

Viele Grüße,
Stephan Schuster
__________________________________________________________

Abt.: Systementwicklung       Wilken GmbH
Tel: (+49)0731/9650-324       Software. Menschen. Service.
Fax: (+49)0731/9650-767
E-Mail: stsch@wilken.de       Hörvelsinger Weg 25-29
Internet: www.wilken.de       D-89081 Ulm

Wilken GmbH, HRB Ulm 794, GF: Dr. Andreas Lied
__________________________________________________________

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


Re: [vfs] webdav, jackrabbit and fileObject.exists()

Posted by jharrop <ja...@plutext.org>.
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