felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: OSGi URL to file
Date Wed, 13 Sep 2006 23:52:36 GMT
No, there is no standard way, nor any equivalent method in Felix.

This is something you could construct for Felix, perhaps, but it seems 
like bad form since the whole point of getResource() is to eliminate the 
dependencies on file locations.

And what happens if the resource is in a JAR file, then it will never be 
a file: resource?

You might be trying to do something and this is the only way to do it, 
but it would certainly be better if there was another way.

-> richard

Erik Bengtson wrote:
> Hi,
> I need to convert the URL given by
> URL url =
> Bundle.loadClass('something').getClassLoader().getResource('anotherthing');
> Using equinox I get "bundleresource://" protocol, so I want to convert to
> file://.
> To convert I use:
> URL fileURL = org.eclipse.core.runtime.FileLocator.toFileURL(url);
> Is there an Felix equivalent or in the OSGI standard?
> Thanks,
> Erik Bengtson
> PS:
> Richard,
> thanks for the previous answer regarding best pratices on dependencies.

View raw message