public class OSGiWebappClassLoader extends WebAppClassLoader implements org.osgi.framework.BundleReference
WebAppClassLoader.Context
Modifier and Type | Field and Description |
---|---|
static java.util.Set<java.lang.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(java.lang.ClassLoader parent,
WebAppContext context,
org.osgi.framework.Bundle contributor) |
Modifier and Type | Method and Description |
---|---|
void |
addClassPath(java.lang.String classPath)
Parse the classpath ourselves to be able to filter things.
|
static void |
addClassThatIdentifiesAJarThatMustBeRejected(java.lang.Class<?> zclass) |
static void |
addClassThatIdentifiesAJarThatMustBeRejected(java.lang.String zclassName) |
protected java.lang.Class<?> |
findClass(java.lang.String name) |
java.net.URL |
findResource(java.lang.String name) |
org.osgi.framework.Bundle |
getBundle()
Returns the
Bundle that defined this web-application. |
java.net.URL |
getResource(java.lang.String name)
Get a resource from the classloader
NOTE: this method provides a convenience of hacking off a leading /
should one be present.
|
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String name) |
protected java.lang.Class<?> |
loadAsResource(java.lang.String name,
boolean checkSystemResource)
Try to load the class from the bundle classloader.
|
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, foundClass, getContext, getName, getPermissions, loadClass, removeClassFileTransformer, removeTransformer, runWithServerClassAccess, setName, toString
addURL, definePackage, findResources, getResourceAsStream, getURLs, newInstance, newInstance
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public static final java.util.Set<java.lang.String> JAR_WITH_SUCH_CLASS_MUST_BE_EXCLUDED
public OSGiWebappClassLoader(java.lang.ClassLoader parent, WebAppContext context, org.osgi.framework.Bundle contributor) throws java.io.IOException
parent
- The parent classloader.context
- The WebAppContextcontributor
- The bundle that defines this web-application.java.io.IOException
- if unable to cerate the OSGiWebappClassLoaderpublic static void addClassThatIdentifiesAJarThatMustBeRejected(java.lang.Class<?> zclass)
public static void addClassThatIdentifiesAJarThatMustBeRejected(java.lang.String zclassName)
protected java.lang.Class<?> findClass(java.lang.String name) throws java.lang.ClassNotFoundException
findClass
in class WebAppClassLoader
java.lang.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 java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException
getResources
in class WebAppClassLoader
java.io.IOException
public java.net.URL getResource(java.lang.String name)
WebAppClassLoader
getResource
in class WebAppClassLoader
public java.net.URL findResource(java.lang.String name)
findResource
in class java.net.URLClassLoader
protected java.lang.Class<?> loadAsResource(java.lang.String name, boolean checkSystemResource) throws java.lang.ClassNotFoundException
loadAsResource
in class WebAppClassLoader
name
- the name of the class to loadcheckSystemResource
- if true and the class isn't a system class we return itjava.lang.ClassNotFoundException
WebAppClassLoader.loadAsResource(java.lang.String, boolean)
public void addClassPath(java.lang.String classPath) throws java.io.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 '/'.java.io.IOException
- if unable to add classpathpublic void setWebappContext(WebAppContext webappContext)
webappContext
- the web app contextCopyright © 1995–2023 Webtide. All rights reserved.