TheProjecter / sardine

Automatically exported from code.google.com/p/sardine
0 stars 0 forks source link

Test exist() on folder #117

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello.

I'm using your API since few days and I've want to test if an folder exist, and 
i've been an error :

com.googlecode.sardine.impl.SardineException: Unexpected response (403 
Forbidden)
    at com.googlecode.sardine.impl.handler.ExistsResponseHandler.handleResponse(ExistsResponseHandler.java:45)
    at com.googlecode.sardine.impl.handler.ExistsResponseHandler.handleResponse(ExistsResponseHandler.java:31)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:945)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
    at com.googlecode.sardine.impl.SardineImpl.execute(SardineImpl.java:691)
    at com.googlecode.sardine.impl.SardineImpl.exists(SardineImpl.java:672)

So this method is okay to test a file, but not for a folder ;)

ps : Excuse my english, I'm french.

Original issue reported on code.google.com by delphin....@gmail.com on 10 Mar 2012 at 6:13

GoogleCodeExporter commented 9 years ago
As far as I can tell, that is the server telling you that you don't have 
permission to access that folder.

Original comment by latch...@gmail.com on 10 Mar 2012 at 6:28

GoogleCodeExporter commented 9 years ago
I can create a folder, i can delete a folder, i can create in theses folders 
files by sardine.put or read with sargine.get, but i can't use exist() just in 
a folder :/ It's just a problem of permission?
Manifest of your lib (for version) :
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 20.2-b06-393 (Apple Inc.)
Specification-Version: 314
Implementation-Version: November 18 2011
Main-Class: com.googlecode.sardine.Version

Original comment by delphin....@gmail.com on 10 Mar 2012 at 7:42

GoogleCodeExporter commented 9 years ago
403 Forbidden is clearly a server response.

Lets see some code, some logs on the server, etc...

Original comment by latch...@gmail.com on 10 Mar 2012 at 7:50

GoogleCodeExporter commented 9 years ago
I also had exists() not working with a folder.
I fixed that by adding:

    Options Indexes FollowSymLinks

to my dav settings.

FYI, my dav settings are kept in a separate conf file, as listed below. I'm 
running apache2 on osx.

#
# The User/Group specified in httpd.conf needs to have write permissions
# on the directory where the DavLockDB is placed and on any directory where
# "Dav On" is specified.

#
# www.maximporges.com/2010/06/16/setting-up-webdav-on-os-x
#

#LimitXMLRequestBody 131072

DavLockDB /var/dav/DavLock

Alias /dav "/Users/ianw/my/w/e.docroot"

<Directory "/Users/ianw/my/w/e.docroot">
  Dav On
    AllowOverride None
    Options Indexes FollowSymLinks
    Order Allow,Deny
    Allow from all
    AuthType Basic
    AuthName WebDAV-Realm
    AuthUserFile "/Users/ianw/my/apache/conf/dav.passwd"
    <LimitExcept GET OPTIONS>
        require user admin
    </LimitExcept>
</Directory>

#
# The following directives disable redirects on non-GET requests for
# a directory that does not include the trailing slash.  This fixes a 
# problem with several clients that do not appropriately handle 
# redirects for folders with DAV methods.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" 
redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

Original comment by biancash...@gmail.com on 28 Mar 2012 at 4:57

GoogleCodeExporter commented 9 years ago
Thank you very much for all these answers. I have now managed to use it. My 
problem was very subtle in my sources -_-"

Original comment by delphin....@gmail.com on 29 Apr 2012 at 6:48

GoogleCodeExporter commented 9 years ago

Original comment by dkocher@sudo.ch on 21 Jun 2012 at 4:58

GoogleCodeExporter commented 9 years ago
Hey delphin, How did you fix it?

Original comment by ashley.j...@gmail.com on 4 Sep 2013 at 12:16