|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.ClassLoader java.security.SecureClassLoader java.net.URLClassLoader org.apache.cocoon.servlet.ParanoidClassLoader
public class ParanoidClassLoader
The ParanoidClassLoader
reverses the search order for classes.
It checks this classloader before it checks its parent.
Constructor Summary | |
---|---|
ParanoidClassLoader()
Default constructor has no parents or initial URL s. |
|
ParanoidClassLoader(ClassLoader parent)
Alternate constructor to define a parent. |
|
ParanoidClassLoader(URL[] urls)
Alternate constructor to define initial URL s. |
|
ParanoidClassLoader(URL[] urls,
ClassLoader parent)
Alternate constructor to define a parent and initial URL
s. |
|
ParanoidClassLoader(URL[] urls,
ClassLoader parent,
URLStreamHandlerFactory factory)
Alternate constructor to define a parent, initial URL s,
and a default URLStreamHandlerFactory . |
Method Summary | |
---|---|
void |
addDirectory(File file)
Adds a new directory of class files. |
void |
addURL(URL url)
Adds a new URL |
URL |
getResource(String name)
Gets a resource from this ClassLoader. |
Class |
loadClass(String name,
boolean resolve)
Loads the class from this ClassLoader. |
static URLClassLoader |
newInstance(URL[] urls)
Extends URLClassLoader 's initialization methods so we
return a ParanoidClassLoad instead. |
static URLClassLoader |
newInstance(URL[] urls,
ClassLoader parent)
Extends URLClassLoader 's initialization methods so we
return a ParanoidClassLoad instead. |
Methods inherited from class java.net.URLClassLoader |
---|
definePackage, findClass, findResource, findResources, getPermissions, getURLs |
Methods inherited from class java.security.SecureClassLoader |
---|
defineClass, defineClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParanoidClassLoader()
URL
s.
public ParanoidClassLoader(ClassLoader parent)
public ParanoidClassLoader(URL[] urls)
URL
s.
public ParanoidClassLoader(URL[] urls, ClassLoader parent)
URL
s.
public ParanoidClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
URL
s,
and a default URLStreamHandlerFactory
.
Method Detail |
---|
public static final URLClassLoader newInstance(URL[] urls)
URLClassLoader
's initialization methods so we
return a ParanoidClassLoad
instead.
public static final URLClassLoader newInstance(URL[] urls, ClassLoader parent)
URLClassLoader
's initialization methods so we
return a ParanoidClassLoad
instead.
public final Class loadClass(String name, boolean resolve) throws ClassNotFoundException
ClassLoader. If the
class does not exist in this one, we check the parent. Please
note that this is the exact opposite of the
ClassLoader
spec. We use it to work around
inconsistent class loaders from third party vendors.
- Overrides:
loadClass
in class ClassLoader
- Parameters:
name
- the name of the classresolve
- if true
then resolve the class
- Returns:
- the resulting
Class
object
- Throws:
ClassNotFoundException
- if the class could not be found
public final URL getResource(String name)
ClassLoader. If the
resource does not exist in this one, we check the parent.
Please note that this is the exact opposite of the
ClassLoader
spec. We use it to work around
inconsistent class loaders from third party vendors.
- Overrides:
getResource
in class ClassLoader
- Parameters:
name
- of resource
public final void addDirectory(File file) throws IOException
file
- for jar or directory
IOException
public void addURL(URL url)
addURL
in class URLClassLoader
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |