commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Hartford" <dhartf...@ghsinc.com>
Subject [commons-vfs] webdav createFile
Date Tue, 28 Aug 2007 19:43:24 GMT
Hey all,
Trying something trivial to create a file on a WebDav server:

FileSystemManager fsm = VFS.getManager();
FileObject object =
fsm.resolveFile("webdav://admin:password@localhost:8080/webdav-server/re
pository/default/subdir1/");

FileObject child = fsm.resolveFile(object,"newfile.txt");
boolean childexist = child.exists();
if(!childexist){
	child.createFile();
}

The fsm works fine, the first FileObject works fine and when used to
getChildren(), returns the proper children.

However, When I try a file that is known not to exist, I instead get the
error on the exist() method before even getting to create (which also
causes the same error if I skip exist()):
=================
Exception in thread "main" org.apache.commons.vfs.FileSystemException:
Could not determine the type of file
"webdav://admin:password@localhost:8080/webdav-server/repository/default
/subdir1/newfile.txt".
	at
org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileOb
ject.java:1212)
	at
org.apache.commons.vfs.provider.AbstractFileObject.exists(AbstractFileOb
ject.java:391)
	at asdf.main(asdf.java:20)
Caused by: org.apache.commons.vfs.FileSystemException
	at
org.apache.commons.vfs.provider.webdav.WebdavFileObject.setDavResource(W
ebdavFileObject.java:160)
	at
org.apache.commons.vfs.provider.webdav.WebdavFileObject.doAttach(WebdavF
ileObject.java:75)
	at
org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileOb
ject.java:1198)
	... 2 more
Caused by: org.apache.commons.httpclient.HttpException
	at
org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:
3467)
	at
org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:
3423)
	at
org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:96
7)
	at
org.apache.webdav.lib.WebdavResource.setDefaultProperties(WebdavResource
.java:954)
	at
org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1
897)
	at
org.apache.commons.vfs.provider.webdav.WebdavFileObject.setDavResource(W
ebdavFileObject.java:156)
	... 4 more
============


I'm using the following binaries as 1.0 does not have webdav support
built in:

    <dependency>
      <groupId>commons-vfs</groupId>
      <artifactId>commons-vfs</artifactId>
      <version>20050307052300</version>
    </dependency>
    <dependency>
      <groupId>jdom</groupId>
      <artifactId>jdom</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>commons-httpclient</groupId>
      <artifactId>commons-httpclient</artifactId>
      <version>2.0.2</version>
    </dependency>
    <dependency>
      <groupId>slide</groupId>
      <artifactId>slide-webdavlib</artifactId>
      <version>2.1</version>
    </dependency>


What are my options that would be KNOWN to work correctly (please, no
assumptions...)?

Thanks,
-D

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


Mime
View raw message