public class OSGiWebappClassLoader extends WebAppClassLoader implements org.osgi.framework.BundleReference
WebAppClassLoader.Context
Modifier and Type | Field and Description |
---|---|
static Set<String> |
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 and Description |
---|
OSGiWebappClassLoader(ClassLoader parent,
WebAppContext context,
org.osgi.framework.Bundle contributor) |
Modifier and Type | Method and Description |
---|---|
void |
addClassPath(String classPath)
Parse the classpath ourselves to be able to filter things.
|
static void |
addClassThatIdentifiesAJarThatMustBeRejected(Class<?> zclass) |
static void |
addClassThatIdentifiesAJarThatMustBeRejected(String zclassName) |
org.osgi.framework.Bundle |
getBundle()
Returns the
Bundle that defined this web-application. |
URL |
getResource(String name)
Get a resource from the classloader
NOTE: this method provides a convenience of hacking off a leading /
should one be present.
|
Enumeration<URL> |
getResources(String name) |
Class<?> |
loadClass(String name) |
void |
setWebappContext(WebAppContext webappContext)
In the case of the generation of a webapp via a jetty context file we
need a proper classloader to setup the app before we have the
WebappContext So we place a fake one there to start with.
|
addClassFileTransformer, addClassPath, addJars, addTransformer, close, findClass, foundClass, getContext, getName, getPermissions, loadClass, removeClassFileTransformer, removeTransformer, runWithServerClassAccess, setName, toString
addURL, definePackage, findResource, findResources, getResourceAsStream, getURLs, newInstance, newInstance
defineClass, defineClass
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public OSGiWebappClassLoader(ClassLoader parent, WebAppContext context, org.osgi.framework.Bundle contributor) throws IOException
parent
- The parent classloader.context
- The WebAppContextcontributor
- The bundle that defines this web-application.IOException
- if unable to cerate the OSGiWebappClassLoaderpublic static void addClassThatIdentifiesAJarThatMustBeRejected(Class<?> zclass)
public static void addClassThatIdentifiesAJarThatMustBeRejected(String zclassName)
public Class<?> loadClass(String name) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
public org.osgi.framework.Bundle getBundle()
Bundle
that defined this web-application.getBundle
in interface org.osgi.framework.BundleReference
Bundle
object associated with this
BundleReference
.public Enumeration<URL> getResources(String name) throws IOException
getResources
in class WebAppClassLoader
IOException
public URL getResource(String name)
WebAppClassLoader
getResource
in class WebAppClassLoader
public void addClassPath(String classPath) throws IOException
addClassPath
in class WebAppClassLoader
classPath
- Comma or semicolon separated path of filenames or URLs
pointing to directories or jar files. Directories should end
with '/'.IOException
- if unable to add classpathpublic void setWebappContext(WebAppContext webappContext)
webappContext
- the web app contextCopyright © 1995–2017 Webtide. All rights reserved.