org.eclipse.jetty.osgi.boot.internal.webapp
Class OSGiWebappClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.eclipse.jetty.webapp.WebAppClassLoader
                  extended by org.eclipse.jetty.osgi.boot.internal.webapp.OSGiWebappClassLoader

public class OSGiWebappClassLoader
extends WebAppClassLoader

Extends the webappclassloader to insert the classloader provided by the osgi bundle at the same level than any other jars palced in the webappclassloader.


Field Summary
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 Summary
OSGiWebappClassLoader(ClassLoader parent, WebAppContext context, org.osgi.framework.Bundle contributor)
           
 
Method Summary
 void addClassPath(String classPath)
          Parse the classpath ourselves to be able to filter things.
static void addClassThatIdentifiesAJarThatMustBeRejected(Class<?> zclass)
           
static void addClassThatIdentifiesAJarThatMustBeRejected(String zclassName)
           
protected  Class<?> findClass(String name)
           
 URL getResource(String name)
           
 Enumeration<URL> getResources(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.
 
Methods inherited from class org.eclipse.jetty.webapp.WebAppClassLoader
addJars, destroy, getContext, getName, getPermissions, loadClass, loadClass, setName, toString
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findResource, findResources, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JAR_WITH_SUCH_CLASS_MUST_BE_EXCLUDED

public 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 Detail

OSGiWebappClassLoader

public OSGiWebappClassLoader(ClassLoader parent,
                             WebAppContext context,
                             org.osgi.framework.Bundle contributor)
                      throws IOException
Throws:
IOException
Method Detail

addClassThatIdentifiesAJarThatMustBeRejected

public static void addClassThatIdentifiesAJarThatMustBeRejected(Class<?> zclass)

addClassThatIdentifiesAJarThatMustBeRejected

public static void addClassThatIdentifiesAJarThatMustBeRejected(String zclassName)

getResources

public Enumeration<URL> getResources(String name)
                              throws IOException
Overrides:
getResources in class WebAppClassLoader
Throws:
IOException

getResource

public URL getResource(String name)
Overrides:
getResource in class WebAppClassLoader

findClass

protected Class<?> findClass(String name)
                      throws ClassNotFoundException
Overrides:
findClass in class URLClassLoader
Throws:
ClassNotFoundException

addClassPath

public void addClassPath(String classPath)
                  throws IOException
Parse the classpath ourselves to be able to filter things. This is a derivative work of the super class

Overrides:
addClassPath in class WebAppClassLoader
Parameters:
classPath - Comma or semicolon separated path of filenames or URLs pointing to directories or jar files. Directories should end with '/'.
Throws:
IOException

setWebappContext

public 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. We replace it with the actual webapp context with this method. We also apply the extraclasspath there at the same time.



Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.