org.mortbay.http
Class ContextLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.mortbay.http.ContextLoader

public class ContextLoader
extends java.net.URLClassLoader

ClassLoader for HttpContext. Specializes URLClassLoader with some utility and file mapping methods. This loader defaults to the 2.3 servlet spec behaviour where non system classes are loaded from the classpath in preference to the parent loader. Java2 compliant loading, where the parent loader always has priority, can be selected with the setJava2Complient method.

Version:
$Id: ContextLoader.java,v 1.38 2007/09/04 00:49:35 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Constructor Summary
ContextLoader(HttpContext context, java.lang.String classPath, java.lang.ClassLoader parent, java.security.PermissionCollection permisions)
          Constructor.
 
Method Summary
 void destroy()
           
 java.security.PermissionCollection getPermissions(java.security.CodeSource cs)
           
 java.net.URL getResource(java.lang.String name)
           
 boolean isJava2Compliant()
           
 boolean isServerPath(java.lang.String name)
           
 boolean isSystemPath(java.lang.String name)
           
 java.lang.Class loadClass(java.lang.String name)
           
protected  java.lang.Class loadClass(java.lang.String name, boolean resolve)
           
 void setJava2Compliant(boolean compliant)
          Set Java2 compliant status.
 java.lang.String toString()
           
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, 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, getResources, 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
 

Constructor Detail

ContextLoader

public ContextLoader(HttpContext context,
                     java.lang.String classPath,
                     java.lang.ClassLoader parent,
                     java.security.PermissionCollection permisions)
              throws java.net.MalformedURLException,
                     java.io.IOException
Constructor.

Parameters:
classPath - Comma separated path of filenames or URLs pointing to directories or jar files. Directories should end with '/'.
Throws:
java.io.IOException
java.net.MalformedURLException
Method Detail

setJava2Compliant

public void setJava2Compliant(boolean compliant)
Set Java2 compliant status.

Parameters:
compliant -

isJava2Compliant

public boolean isJava2Compliant()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPermissions

public java.security.PermissionCollection getPermissions(java.security.CodeSource cs)
Overrides:
getPermissions in class java.net.URLClassLoader

loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Overrides:
loadClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException

loadClass

protected java.lang.Class loadClass(java.lang.String name,
                                    boolean resolve)
                             throws java.lang.ClassNotFoundException
Overrides:
loadClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException

getResource

public java.net.URL getResource(java.lang.String name)
Overrides:
getResource in class java.lang.ClassLoader

isServerPath

public boolean isServerPath(java.lang.String name)

isSystemPath

public boolean isSystemPath(java.lang.String name)

destroy

public void destroy()


Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.