org.mortbay.jetty.webapp
Class TransformingWebAppClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byjava.security.SecureClassLoader
          extended byjava.net.URLClassLoader
              extended byorg.mortbay.jetty.webapp.WebAppClassLoader
                  extended byorg.mortbay.jetty.webapp.TransformingWebAppClassLoader
All Implemented Interfaces:
Cloneable, Transformer

public class TransformingWebAppClassLoader
extends WebAppClassLoader
implements Transformer

Transforming Web Application ClassLoader. This extension to WebAppClassLoader provides the ability for the bytes of the classes to be transformed as they are loaded. This is achieved by installing the Handler instance of URLStreamHandler for the psuedo protocol "tx". This allows loading by a URLClassLoader to be intercepted, but it also requests that this class extract all jar files to a temporary directory.

When a resource is loaded, the transform(URL, byte[]) method is called, which should be extended by a derived class to implement the required transformations.

Author:
gregw

Constructor Summary
TransformingWebAppClassLoader(ClassLoader parent, WebAppContext context)
           
TransformingWebAppClassLoader(WebAppContext context)
           
 
Method Summary
 void addURL(URL url)
           
 URL findResource(String name)
           
 Enumeration findResources(String name)
           
 URL getResource(String name)
           
 byte[] transform(URL src, byte[] content)
           
 
Methods inherited from class org.mortbay.jetty.webapp.WebAppClassLoader
addClassPath, addJars, clone, destroy, getContext, getPermissions, isServerPath, isSystemPath, loadClass, loadClass, toString
 
Methods inherited from class java.net.URLClassLoader
definePackage, findClass, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransformingWebAppClassLoader

public TransformingWebAppClassLoader(WebAppContext context)

TransformingWebAppClassLoader

public TransformingWebAppClassLoader(ClassLoader parent,
                                     WebAppContext context)
Method Detail

addURL

public void addURL(URL url)

transform

public byte[] transform(URL src,
                        byte[] content)
Specified by:
transform in interface Transformer

getResource

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

findResource

public URL findResource(String name)

findResources

public Enumeration findResources(String name)
                          throws IOException
Throws:
IOException