commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Fortner <phidia...@gmail.com>
Subject Re: Cannot connect to a webDAV server
Date Mon, 02 Feb 2009 18:11:51 GMT
AFAIK VFS uses a mechanism similar to the SPI mechanism (
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider)
to automatically "discover" VFS implementations in the classpath.  Each VFS
provider is packaged with it's own vfs-providers.xml file which contains
information required to instantiate and properly configure that plugin.  No
other configuration should be required to get a plugin to work.

The StandardFileSystemManager class that James pointed to earlier also
indicates that you can turn on debugging to find out if your provider is not
loading due to some unsatisfied dependency.

To get an instance of a provider, you should only have to call the
VFS.getManager().resolve method to load the file manager needed to resolve
your file.

Hope this helps,

Mark


On Mon, Feb 2, 2009 at 8:51 AM, Ralph Goers <ralph.goers@dslextreme.com>wrote:

> I'm not sure if we are speaking past each other here. There is no
> vfs-providers.xml in the core source, so none of those providers should be
> automatically configured. Instead, the user has to create the file and
> configure the providers they want. Correct?
>
> Ralph
>
>
> On Feb 2, 2009, at 8:25 AM, James Carman wrote:
>
>  The plugin (non-core) providers are also auto-registered that way.
>>
>> On Mon, Feb 2, 2009 at 11:22 AM, Ralph Goers <ralph.goers@dslextreme.com>
>> wrote:
>>
>>> Right. that is a config file, not a provider. The user has to configure
>>> the
>>> providers they want.
>>>
>>> On Feb 2, 2009, at 7:27 AM, James Carman wrote:
>>>
>>>  It scans the classpath for all resources named
>>>> "META-INF/vfs-providers.xml":
>>>>
>>>>
>>>>
>>>> http://svn.apache.org/repos/asf/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
>>>>
>>>>
>>>> On Mon, Feb 2, 2009 at 10:01 AM, Ralph Goers <
>>>> ralph.goers@dslextreme.com>
>>>> wrote:
>>>>
>>>>>
>>>>> It's possible I'm missing something. Where does that happen? I'm not
>>>>> seeing
>>>>> anything call addProvider based on the class path.
>>>>>
>>>>> Ralph
>>>>>
>>>>> On Feb 2, 2009, at 4:27 AM, James Carman wrote:
>>>>>
>>>>>  Shouldn't it auto-register, if it's on the classpath?
>>>>>>
>>>>>> On Mon, Feb 2, 2009 at 12:53 AM, Ralph Goers
>>>>>> <ralph.goers@dslextreme.com>
>>>>>> wrote:
>>>>>>
>>>>>>>
>>>>>>> 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: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
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>>>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: user-help@commons.apache.org
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


-- 
Mark Fortner

blog: http://feeds.feedburner.com/jroller/ideafactory

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