make the webapp classloader impleemnt the BundleReference interface just like any other OSGi classloader
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1557 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
a022459fab
commit
fb450b822b
|
@ -35,12 +35,13 @@ import org.eclipse.jetty.util.resource.Resource;
|
|||
import org.eclipse.jetty.webapp.WebAppClassLoader;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleReference;
|
||||
|
||||
/**
|
||||
* Extends the webappclassloader to insert the classloader provided by the osgi
|
||||
* bundle at the same level than any other jars palced in the webappclassloader.
|
||||
*/
|
||||
public class OSGiWebappClassLoader extends WebAppClassLoader
|
||||
public class OSGiWebappClassLoader extends WebAppClassLoader implements BundleReference
|
||||
{
|
||||
|
||||
private Logger __logger = Log.getLogger(OSGiWebappClassLoader.class.getName().toString());
|
||||
|
@ -67,15 +68,34 @@ public class OSGiWebappClassLoader extends WebAppClassLoader
|
|||
}
|
||||
|
||||
private ClassLoader _osgiBundleClassLoader;
|
||||
private Bundle _contributor;
|
||||
private boolean _lookInOsgiFirst = true;
|
||||
private Set<String> _libsAlreadyInManifest = new HashSet<String>();
|
||||
|
||||
/**
|
||||
* @param parent The parent classloader. In this case
|
||||
* @param context The WebAppContext
|
||||
* @param contributor The bundle that defines this web-application.
|
||||
* @throws IOException
|
||||
*/
|
||||
public OSGiWebappClassLoader(ClassLoader parent, WebAppContext context, Bundle contributor) throws IOException
|
||||
{
|
||||
super(parent,context);
|
||||
_contributor = contributor;
|
||||
_osgiBundleClassLoader = WebappRegistrationHelper.BUNDLE_CLASS_LOADER_HELPER.getBundleClassLoader(contributor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>Bundle</code> that defined this web-application.
|
||||
*
|
||||
* @return The <code>Bundle</code> object associated with this
|
||||
* <code>BundleReference</code>.
|
||||
*/
|
||||
public Bundle getBundle()
|
||||
{
|
||||
return _contributor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the manifest. If the manifest is already configured to loads a few
|
||||
* libs we should not add them to the classpath of the webapp. Not really
|
||||
|
|
Loading…
Reference in New Issue