[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] getResources in Servlet.init() - returns a resource twice

The following code snippet is used to get a single resource URL that is packaged in the bundle jar. This code returns a single URL when invoked from BundleAcivator.activate() but returns two URLs when invoked from Servlet.init(). I printed out the classloader classes from these two invocations. I attached the test bundle to duplicate the issue. The BundleProxyClassLoader in servlet case is returning one through parent loader and one for 'this' loader. This seems like bug but I could be wrong. I am using the 3.2 release bundles for this test

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Enumeration urls = cl.getResources("META-INF/helloworld.txt");
        System.out.println("Resources in bundle with classloader :" + cl);
        while(urls.hasMoreElements()) {
            URL url = "">            System.out.println(url);

==> Output from BundleAcivator.activate()
Resources in bundle with classloader :org.eclipse.core.runtime.internal.adaptor.ContextFinder@17494c8

==> Output from Servlet.init()
Resources in servlet with classloader :org.eclipse.equinox.servlet.bridge.http.internal.ServletRegistration$BundleProxyClassLoader@c0f1ec

-Ravi R

Attachment: helloworld_1.0.0.jar
Description: Binary data