commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ma...@ops.co.at>
Subject [VFS] url handler (war: Re: [VFS] build broken)
Date Fri, 06 Jan 2006 07:20:27 GMT
Hi Colin!
> Really ? As I see it,  currently I have to do:
>
> FileSystemManager fsManager = VFS.getManager();
> FileObject jarFile = fsManager.resolveFile( "jar:lib/aJarFile.jar" );
>   
URL url = jarFile.getURL();

> FileObject jarFile = (FileObject) new URL("jar:lib/aJarFile.jar").getContent();
>   
Why should the content of the given URL be a FileObject?
> through use of java.protocol.handler.pkgs
>
> I dont think thats currently supported?
>   
No, thats not supported. You are right.

What is supported is to turn any FileObject into an URL to be able to 
pass it to another non VFS aware application. Its also possible to 
resolve other files using the given URL as base.
What you can try to do is to add a handler for a scheme "vfs:" so you 
can do something like this:

URL url = new URL("vfs:jar:lib/aJarFile.jar")

url.getContent() should retrieve the content, if you really would like 
to get access to the FileObject you can try to implement the "hack"
url.getContent(new Class[]{FileObject.class})

The classes to bind URLs with VFS are already available. See 
org.apache.commons.vfs.provider.DefaultURL*

Ciao,
Mario


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


Mime
View raw message