Class OSGiWebappClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.eclipse.jetty.webapp.WebAppClassLoader
org.eclipse.jetty.osgi.boot.internal.webapp.OSGiWebappClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable,org.eclipse.jetty.util.ClassVisibilityChecker,org.osgi.framework.BundleReference
public class OSGiWebappClassLoader
extends org.eclipse.jetty.webapp.WebAppClassLoader
implements org.osgi.framework.BundleReference
OSGiWebappClassLoader
Extends the webapp classloader to also use the classloader of the Bundle defining the webapp.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.webapp.WebAppClassLoader
org.eclipse.jetty.webapp.WebAppClassLoader.Context -
Field Summary
FieldsModifier and TypeFieldDescriptionwhen a logging framework is setup in the osgi classloaders, it can access this and register the classes that must not be found in the jar. -
Constructor Summary
ConstructorsConstructorDescriptionOSGiWebappClassLoader(ClassLoader parent, org.eclipse.jetty.webapp.WebAppContext context, org.osgi.framework.Bundle contributor) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassPath(String classPath) Parse the classpath ourselves to be able to filter things.static voidstatic voidaddClassThatIdentifiesAJarThatMustBeRejected(String zclassName) protected Class<?>findResource(String name) org.osgi.framework.BundleReturns theBundlethat defined this web-application.getResource(String name) getResources(String name) protected Class<?>loadAsResource(String name, boolean checkSystemResource) Try to load the class from the bundle classloader.Methods inherited from class org.eclipse.jetty.webapp.WebAppClassLoader
addClassPath, addJars, addTransformer, close, foundClass, getContext, getName, getPermissions, isServerClass, isSystemClass, loadClass, removeTransformer, runWithServerClassAccess, setName, toStringMethods inherited from class java.net.URLClassLoader
addURL, definePackage, findResources, getResourceAsStream, getURLs, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoader
defineClass, defineClassMethods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
JAR_WITH_SUCH_CLASS_MUST_BE_EXCLUDED
when a logging framework is setup in the osgi classloaders, it can access this and register the classes that must not be found in the jar.
-
-
Constructor Details
-
OSGiWebappClassLoader
public OSGiWebappClassLoader(ClassLoader parent, org.eclipse.jetty.webapp.WebAppContext context, org.osgi.framework.Bundle contributor) throws IOException - Parameters:
parent- The parent classloader.context- The WebAppContextcontributor- The bundle that defines this web-application.- Throws:
IOException- if unable to cerate the OSGiWebappClassLoader
-
-
Method Details
-
addClassThatIdentifiesAJarThatMustBeRejected
-
addClassThatIdentifiesAJarThatMustBeRejected
-
findClass
- Overrides:
findClassin classorg.eclipse.jetty.webapp.WebAppClassLoader- Throws:
ClassNotFoundException
-
getBundle
public org.osgi.framework.Bundle getBundle()Returns theBundlethat defined this web-application.- Specified by:
getBundlein interfaceorg.osgi.framework.BundleReference- Returns:
- The
Bundleobject associated with thisBundleReference.
-
getResources
- Overrides:
getResourcesin classorg.eclipse.jetty.webapp.WebAppClassLoader- Throws:
IOException
-
getResource
- Overrides:
getResourcein classorg.eclipse.jetty.webapp.WebAppClassLoader
-
findResource
- Overrides:
findResourcein classURLClassLoader
-
loadAsResource
protected Class<?> loadAsResource(String name, boolean checkSystemResource) throws ClassNotFoundException Try to load the class from the bundle classloader. We do NOT load it as a resource as the WebAppClassLoader does because the url that is returned is an osgi-special url that does not play properly with WebAppClassLoader's method of extracting the class from the resource. This implementation directly asks the osgi bundle classloader to load the given class name.- Overrides:
loadAsResourcein classorg.eclipse.jetty.webapp.WebAppClassLoader- Throws:
ClassNotFoundException- See Also:
-
WebAppClassLoader.loadAsResource(java.lang.String, boolean)
-
addClassPath
Parse the classpath ourselves to be able to filter things. This is a derivative work of the super class- Overrides:
addClassPathin classorg.eclipse.jetty.webapp.WebAppClassLoader- Throws:
IOException
-