Hi folks, According to my research, getEntry() only ever looks in the specific bundle regardless of dependencies. Instead, getResource() will follow the classpath in order to find some resource, so it can examine dependencies too.
Regards, Leonardo On Thu, Apr 26, 2012 at 9:09 AM, Claus Ibsen <[email protected]> wrote: > Hi > > I was looking into > https://issues.apache.org/jira/browse/CAMEL-5223 > > And that leads me to the camel-core-osgi component where we have our > OSGi empowered Camel stuff. > And the class org.apache.camel.core.osgi.OsgiClassResolver is used for > loading resources and classes from OSGi. > > Now I got a bit baffled that the method to load a resource from the > classpath, such as a .xslt file, or what ever the user wants is > implemented as: > > public URL loadResourceAsURL(String uri) { > ObjectHelper.notEmpty(uri, "uri"); > return bundleContext.getBundle().getEntry(uri); > } > > Now reading the javadoc for getEntry it seems that it doesnt use > classloader at all, but some other means of loading the resource. > There is another method called getResource. > > So I wonder if it should have been implemented as > > public URL loadResourceAsURL(String uri) { > ObjectHelper.notEmpty(uri, "uri"); > return bundleContext.getBundle().getResource(uri); > } > > Guillaume in case you read this. The code was developed by you. So > maybe you have a thought about this? > > > > -- > Claus Ibsen > ----------------- > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com > FuseSource > Email: [email protected] > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ > -- ---==========================--- The goal of all theory is to make the basic elements as simple and as few as possible without having to surrender the adequate representation of experience —Albert Einstein, physicist ---==========================---
