I don't see where you registered the webdav provider with the manager. You shouldn't need to call WebdavFileSystemConfigBuilder.getInstance(). instead, follow one of the methods shown at http://commons.apache.org/vfs/api.html to add the WebdavFileProvider.

Whether or not you get this working, please post back with your results along with info about the webdav server you are connecting to. I've only tested with Day CRX (which is really Jackrabbit as far as WebDAV is concerned) so I'd like to know what your results are.

Ralph


On Feb 1, 2009, at 8:25 PM, Manish Saroha wrote:

Hi All,

I am new to webDAV and trying to connect to a webDAV server using the commons VFS. Checked out the source code and builded the *commons-vfs-2.0- SNAPSHOT.jar *using the ant task "jar".

my code to connect is as follows:

  static public FileObject getFileObject() throws FileSystemException
  {
      String scheme = "webdav://" ;
      String hostName = "sakai-vre.its.monash.edu.au" ;
      int port = 8080;
      int defaultPort = 8080;
      String userName = "username";
      String password = "password" ;
      String path = "dav/a9d8c946-4bbf-4c2b-8db5-0a62c8724683/";
String uriString = scheme + userName + ":" + password + "@" + hostName + ":" + port + "/" + path; //String uriString = scheme + hostName + ":" + port + "/" + path; StaticUserAuthenticator auth = new StaticUserAuthenticator(null, userName, "password");
      FileSystemOptions opts = new FileSystemOptions();
DefaultFileSystemConfigBuilder .getInstance().setUserAuthenticator(opts, auth); WebdavFileSystemConfigBuilder .getInstance().setProxyAuthenticator(opts, auth) ;
           return VFS.getManager().resolveFile(uriString, opts);
  }
}



I am getting this error

15:19:27,953 INFO DefaultFileReplicator:122 - Using "D: \DOCUME~1\masaroha\LOCALS~1\Temp\vfs_cache" as temporary files store. org.apache.commons.vfs.FileSystemException: *Badly formed URI "webdav://username:[email protected]:8080/dav/ a9d8c946-4bbf-4c2b-8db5-0a62c8724683/".* at org .apache .commons .vfs.provider.url.UrlFileProvider.findFile(UrlFileProvider.java:85) at org .apache .commons .vfs .impl .DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java: 662) at org .apache .commons .vfs .impl .DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java: 582) at au .edu .jcu .hermes .core.filesystem.WebDavConnector.getFileObject(WebDavConnector.java: 107) at au .edu .jcu .hermes.core.filesystem.WebDavConnector.main(WebDavConnector.java:22)
*Caused by: java.net.MalformedURLException: unknown protocol: webdav*
  at java.net.URL.<init>(URL.java:574)
  at java.net.URL.<init>(URL.java:464)
  at java.net.URL.<init>(URL.java:413)
at org .apache .commons .vfs.provider.url.UrlFileProvider.findFile(UrlFileProvider.java:66)
  ... 4 more

Any help or guideline would be appreciated.

Regards,
Manish



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to