commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manish Saroha <manish.sar...@its.monash.edu.au>
Subject Cannot connect to a webDAV server
Date Mon, 02 Feb 2009 04:25:44 GMT
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:password@sakai-vre.its.monash.edu.au: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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message