Apache Tomcat 6.0.53

## org.apache.catalina.loader
Class WebappClassLoader

    java.lang.Object
      java.lang.ClassLoader
          java.security.SecureClassLoader
              java.net.URLClassLoader
                  org.apache.catalina.loader.WebappClassLoader

All Implemented Interfaces:
  Lifecycle, Reloader, PermissionCheck

    public class WebappClassLoader

extends java.net.URLClassLoader
implements Reloader, Lifecycle, PermissionCheck

Specialized web application class loader.

This class loader is a full reimplementation of the `URLClassLoader` from the JDK. It is designed to be fully compatible with a normal `URLClassLoader`, although its internal behavior may be completely different.

IMPLEMENTATION NOTE - This class loader faithfully follows the delegation model recommended in the specification. The system class loader will be queried first, then the local repositories, and only then delegation to the parent class loader will occur. This allows the web application to override any shared class except the classes from J2SE. Special handling is provided from the JAXP XML parser interfaces, the JNDI interfaces, and the classes from the servlet API, which are never loaded from the webapp repository.

IMPLEMENTATION NOTE - Due to limitations in Jasper compilation technology, any repository which contains classes from the servlet API will be ignored by the class loader.

IMPLEMENTATION NOTE - The class loader generates source URLs which include the full JAR URL when a class is loaded from a JAR file, which allows setting security permission at the class level, even when a class is contained inside a JAR.

IMPLEMENTATION NOTE - Local repositories are searched in the order they are added via the initial constructor and/or any subsequent calls to `addRepository()` or `addJar()`.

IMPLEMENTATION NOTE - No check for sealing violations or security is made unless a security manager is present.

Author:
  Remy Maucherat, Craig R. McClanahan

Nested Class Summary
`protected class` | `WebappClassLoader.PrivilegedFindResource` Deprecated. Not used
`protected class` | `WebappClassLoader.PrivilegedFindResourceByName`
`protected class` | `WebappClassLoader.PrivilegedGetClassLoader`

Field Summary
`protected java.security.Permission` | `allPermission` All permission.
`protected java.lang.String` | `canonicalLoaderDir`
`protected boolean` | `delegate` Should this class loader delegate to the parent class loader before searching its own repositories (i.e. the usual Java2 delegation model)?
`static boolean` | `ENABLE_CLEAR_REFERENCES`
`protected java.io.File[]` | `files` Repositories translated as path in the work directory (for Jasper originally), but which is used to generate fake URLs should getURLs be called.
`protected boolean` | `hasExternalRepositories` Has external repositories.
`protected java.util.jar.JarFile[]` | `jarFiles` The list of JARs, in the order they should be searched for locally loaded classes or resources.
`protected java.lang.String[]` | `jarNames` The list of JARs, in the order they should be searched for locally loaded classes or resources.
`protected java.lang.String` | `jarPath` The path which will be monitored for added Jar files.
`protected java.io.File[]` | `jarRealFiles` The list of JARs, in the order they should be searched for locally loaded classes or resources.
`protected long` | `lastJarAccessed` Last time a JAR was accessed.
`protected long[]` | `lastModifiedDates` The list of JARs last modified dates, in the order they should be searched for locally loaded classes or resources.
`protected java.io.File` | `loaderDir` Path where resources loaded from JARs will be extracted.
`protected java.util.HashMap` | `loaderPC` The PermissionCollection for each CodeSource for a web application context.
`protected static Log` | `log`
`protected boolean` | `needConvert` need conversion for properties files
`protected java.util.HashMap<java.lang.String,java.lang.String>` | `notFoundResources` The list of not found resources.
`protected static java.lang.String[]` | `packageTriggers` Set of package names which are not allowed to be loaded from a webapp class loader without delegating first.
`protected java.lang.ClassLoader` | `parent` The parent class loader.
`protected java.lang.String[]` | `paths` The list of resources which should be checked when checking for modifications.
`protected java.util.ArrayList` | `permissionList` A list of read File and Jndi Permission's required if this loader is for a web application context.
`protected java.lang.String[]` | `repositories` The list of local repositories, in the order they should be searched for locally loaded classes or resources.
`protected java.net.URL[]` | `repositoryURLs` Repositories URLs, used to cache the result of getURLs.
`protected java.util.HashMap` | `resourceEntries` The cache of ResourceEntry for classes and resources we have loaded, keyed by resource name.
`protected javax.naming.directory.DirContext` | `resources` Associated directory context giving access to the resources in this webapp.
`protected boolean` | `searchExternalFirst` Search external repositories first
`protected java.lang.SecurityManager` | `securityManager` Instance of the SecurityManager installed.
`protected static StringManager` | `sm` The string manager for this package.
`protected boolean` | `started` Has this component been started?
`protected java.lang.ClassLoader` | `system` The system class loader.
`protected static java.lang.String[]` | `triggers` The set of trigger classes that will cause a proposed repository not to be added if this class is visible to the class loader that loaded this factory class.

Fields inherited from interface org.apache.catalina.Lifecycle
`AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

Constructor Summary
`WebappClassLoader()` Construct a new ClassLoader with no defined repositories and no parent ClassLoader.
`WebappClassLoader(java.lang.ClassLoader parent)` Construct a new ClassLoader with no defined repositories and the given parent ClassLoader.

Method Summary
`void` | `addLifecycleListener(LifecycleListener listener)` Add a lifecycle event listener to this component.
`void` | `addPermission(java.security.Permission permission)` If there is a Java SecurityManager create a Permission.
`void` | `addPermission(java.lang.String path)` If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path.
`void` | `addPermission(java.net.URL url)` If there is a Java SecurityManager create a read FilePermission or JndiPermission for URL.
`void` | `addRepository(java.lang.String repository)` Add a new repository to the set of places this ClassLoader can look for classes to be loaded.
`protected void` | `addURL(java.net.URL url)` Add the specified URL to the classloader.
`boolean` | `check(java.security.Permission permission)` Does this component have the given permission?
`protected void` | `clearReferences()` Clear references.
`void` | `closeJARs(boolean force)` Used to periodically signal to the classloader to release JAR resources.
`protected static void` | `deleteDir(java.io.File dir)` Delete the specified directory, including all of its contents and subdirectories recursively.
`protected boolean` | `filter(java.lang.String name)` Filter classes.
`java.lang.Class` | `findClass(java.lang.String name)` Find the specified class in our local repositories, if possible.
`protected java.lang.Class` | `findClassInternal(java.lang.String name)` Find specified class in local repositories.
`LifecycleListener[]` | `findLifecycleListeners()` Get the lifecycle listeners associated with this lifecycle.
`protected java.lang.Class` | `findLoadedClass0(java.lang.String name)` Finds the class with the given name if it has previously been loaded and cached by this class loader, and return the Class object.
`protected java.io.InputStream` | `findLoadedResource(java.lang.String name)` Finds the resource with the given name if it has previously been loaded and cached by this class loader, and return an input stream to the resource data.
`java.lang.String[]` | `findRepositories()` Return a String array of the current repositories for this class loader.
`java.net.URL` | `findResource(java.lang.String name)` Find the specified resource in our local repository, and return a `URL` refering to it, or `null` if this resource cannot be found.
`protected ResourceEntry` | `findResourceInternal(java.io.File file, java.lang.String path)` Find specified resource in local repositories.
`protected ResourceEntry` | `findResourceInternal(java.lang.String name, java.lang.String path)` Find specified resource in local repositories.
`java.util.Enumeration` | `findResources(java.lang.String name)` Return an enumeration of `URLs` representing all of the resources with the given name.
`boolean` | `getAntiJARLocking()`
`boolean` | `getClearReferencesHttpClientKeepAliveThread()` Return the clearReferencesHttpClientKeepAliveThread flag for this Context.
`boolean` | `getClearReferencesLogFactoryRelease()` Return the clearReferencesLogFactoryRelease flag for this Context.
`boolean` | `getClearReferencesRmiTargets()`
`boolean` | `getClearReferencesStopThreads()` Return the clearReferencesStopThreads flag for this Context.
`boolean` | `getClearReferencesStopTimerThreads()` Return the clearReferencesStopTimerThreads flag for this Context.
`boolean` | `getClearReferencesThreadLocals()` Return the clearReferencesThreadLocals flag for this Context.
`java.lang.String` | `getContextName()` Return the context name for this class loader.
`boolean` | `getDelegate()` Return the "delegate first" flag for this class loader.
`java.lang.String` | `getJarPath()` Return the JAR path.
`protected java.security.PermissionCollection` | `getPermissions(java.security.CodeSource codeSource)` Get the Permissions for a CodeSource.
`java.net.URL` | `getResource(java.lang.String name)` Find the resource with the given name.
`java.io.InputStream` | `getResourceAsStream(java.lang.String name)` Find the resource with the given name, and return an input stream that can be used for reading it.
`javax.naming.directory.DirContext` | `getResources()` Get associated resources.
`boolean` | `getSearchExternalFirst()`
`protected java.net.URL` | `getURI(java.io.File file)` Get URL.
`protected java.net.URL` | `getURL(java.io.File file, boolean encoded)` Get URL.
`java.net.URL[]` | `getURLs()` Returns the search path of URLs for loading classes and resources.
`protected boolean` | `isPackageSealed(java.lang.String name, java.util.jar.Manifest man)` Returns true if the specified package name is sealed according to the given manifest.
`boolean` | `isStarted()`
`java.lang.Class` | `loadClass(java.lang.String name)` Load the class with the specified name.
`java.lang.Class` | `loadClass(java.lang.String name, boolean resolve)` Load the class with the specified name, searching using the following algorithm until it finds and returns the class.
`protected boolean` | `loadedByThisOrChild(java.lang.Class clazz)` Determine whether a class was loaded by this class loader or one of its child class loaders.
`boolean` | `modified()` Have one or more classes or resources been modified so that a reload is appropriate?
`protected boolean` | `openJARs()` Used to periodically signal to the classloader to release JAR resources.
`protected void` | `refreshPolicy()` Refresh the system policy file, to pick up eventual changes.
`void` | `removeLifecycleListener(LifecycleListener listener)` Remove a lifecycle event listener from this component.
`void` | `setAntiJARLocking(boolean antiJARLocking)`
`void` | `setClearReferencesHttpClientKeepAliveThread(boolean clearReferencesHttpClientKeepAliveThread)` Set the clearReferencesHttpClientKeepAliveThread feature for this Context.
`void` | `setClearReferencesLogFactoryRelease(boolean clearReferencesLogFactoryRelease)` Set the clearReferencesLogFactoryRelease feature for this Context.
`void` | `setClearReferencesRmiTargets(boolean clearReferencesRmiTargets)`
`void` | `setClearReferencesStopThreads(boolean clearReferencesStopThreads)` Set the clearReferencesStopThreads feature for this Context.
`void` | `setClearReferencesStopTimerThreads(boolean clearReferencesStopTimerThreads)` Set the clearReferencesStopTimerThreads feature for this Context.
`void` | `setClearReferencesThreadLocals(boolean clearReferencesThreadLocals)` Set the clearReferencesThreadLocals feature for this Context.
`void` | `setDelegate(boolean delegate)` Set the "delegate first" flag for this class loader.
`void` | `setJarPath(java.lang.String jarPath)` Change the Jar path.
`protected void` | `setParentClassLoader(java.lang.ClassLoader pcl)` Utility method for use in subclasses.
`void` | `setResources(javax.naming.directory.DirContext resources)` Set associated resources.
`void` | `setSearchExternalFirst(boolean searchExternalFirst)`
`void` | `setWorkDir(java.io.File workDir)` Change the work directory.
`void` | `start()` Start the class loader.
`void` | `stop()` Stop the class loader.
`java.lang.String` | `toString()` Render a String representation of this object.
`protected boolean` | `validate(java.lang.String name)` Validate a classname.
`protected boolean` | `validateJarFile(java.io.File file)` Check the specified JAR file, and return `true` if it does not contain any of the trigger classes.

Methods inherited from class java.net.URLClassLoader
`definePackage, 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, 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`

Field Detail

### log

    protected static Log log

### ENABLE_CLEAR_REFERENCES

    public static final boolean ENABLE_CLEAR_REFERENCES

### triggers

    protected static final java.lang.String[] triggers

  The set of trigger classes that will cause a proposed repository not to be added if this class is visible to the class loader that loaded this factory class. Typically, trigger classes will be listed for components that have been integrated into the JDK for later versions, but where the corresponding JAR files are required to run on earlier versions.

### packageTriggers

    protected static final java.lang.String[] packageTriggers

  Set of package names which are not allowed to be loaded from a webapp class loader without delegating first.

### sm

    protected static final StringManager sm

  The string manager for this package.

### resources

    protected javax.naming.directory.DirContext resources

  Associated directory context giving access to the resources in this webapp.

### resourceEntries

    protected java.util.HashMap resourceEntries

  The cache of ResourceEntry for classes and resources we have loaded, keyed by resource name.

### notFoundResources

    protected java.util.HashMap<java.lang.String,java.lang.String> notFoundResources

  The list of not found resources.

### delegate

    protected boolean delegate

  Should this class loader delegate to the parent class loader before searching its own repositories (i.e. the usual Java2 delegation model)? If set to `false`, this class loader will search its own repositories first, and delegate to the parent only if the class or resource is not found locally.

### lastJarAccessed

    protected long lastJarAccessed

  Last time a JAR was accessed.

### repositories

    protected java.lang.String[] repositories

  The list of local repositories, in the order they should be searched for locally loaded classes or resources.

### repositoryURLs

    protected java.net.URL[] repositoryURLs

  Repositories URLs, used to cache the result of getURLs.

### files

    protected java.io.File[] files

  Repositories translated as path in the work directory (for Jasper originally), but which is used to generate fake URLs should getURLs be called.

### jarFiles

    protected java.util.jar.JarFile[] jarFiles

  The list of JARs, in the order they should be searched for locally loaded classes or resources.

### jarRealFiles

    protected java.io.File[] jarRealFiles

  The list of JARs, in the order they should be searched for locally loaded classes or resources.

### jarPath

    protected java.lang.String jarPath

  The path which will be monitored for added Jar files.

### jarNames

    protected java.lang.String[] jarNames

  The list of JARs, in the order they should be searched for locally loaded classes or resources.

### lastModifiedDates

    protected long[] lastModifiedDates

  The list of JARs last modified dates, in the order they should be searched for locally loaded classes or resources.

### paths

    protected java.lang.String[] paths

  The list of resources which should be checked when checking for modifications.

### permissionList

    protected java.util.ArrayList permissionList

  A list of read File and Jndi Permission's required if this loader is for a web application context.

### loaderDir

    protected java.io.File loaderDir

  Path where resources loaded from JARs will be extracted.

### canonicalLoaderDir

    protected java.lang.String canonicalLoaderDir

### loaderPC

    protected java.util.HashMap loaderPC

  The PermissionCollection for each CodeSource for a web application context.

### securityManager

    protected java.lang.SecurityManager securityManager

  Instance of the SecurityManager installed.

### parent

    protected java.lang.ClassLoader parent

  The parent class loader.

### system

    protected java.lang.ClassLoader system

  The system class loader.

### started

    protected boolean started

  Has this component been started?

### hasExternalRepositories

    protected boolean hasExternalRepositories

  Has external repositories.

### searchExternalFirst

    protected boolean searchExternalFirst

  Search external repositories first

### needConvert

    protected boolean needConvert

  need conversion for properties files

### allPermission

    protected java.security.Permission allPermission

  All permission.

Constructor Detail

### WebappClassLoader

    public WebappClassLoader()

  Construct a new ClassLoader with no defined repositories and no parent ClassLoader.

### WebappClassLoader

    public WebappClassLoader(java.lang.ClassLoader parent)

  Construct a new ClassLoader with no defined repositories and the given parent ClassLoader.

  Parameters:
    `parent` - Our parent class loader

Method Detail

### getResources

    public javax.naming.directory.DirContext getResources()

  Get associated resources.

### setResources

    public void setResources(javax.naming.directory.DirContext resources)

  Set associated resources.

### getContextName

    public java.lang.String getContextName()

  Return the context name for this class loader.

### getDelegate

    public boolean getDelegate()

  Return the "delegate first" flag for this class loader.

### setDelegate

    public void setDelegate(boolean delegate)

  Set the "delegate first" flag for this class loader.

  Parameters:
    `delegate` - The new "delegate first" flag

### getAntiJARLocking

    public boolean getAntiJARLocking()

  Returns:
    Returns the antiJARLocking.

### setAntiJARLocking

    public void setAntiJARLocking(boolean antiJARLocking)

  Parameters:
    `antiJARLocking` - The antiJARLocking to set.

### getSearchExternalFirst

    public boolean getSearchExternalFirst()

  Returns:
    Returns the searchExternalFirst.

### getClearReferencesRmiTargets

    public boolean getClearReferencesRmiTargets()

### setClearReferencesRmiTargets

    public void setClearReferencesRmiTargets(boolean clearReferencesRmiTargets)

### setSearchExternalFirst

    public void setSearchExternalFirst(boolean searchExternalFirst)

  Parameters:
    `searchExternalFirst` - Whether external repositories should be searched first

### addPermission

    public void addPermission(java.lang.String path)

  If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path.

  Parameters:
    `path` - file directory path

### addPermission

    public void addPermission(java.net.URL url)

  If there is a Java SecurityManager create a read FilePermission or JndiPermission for URL.

  Parameters:
    `url` - URL for a file or directory on local system

### addPermission

    public void addPermission(java.security.Permission permission)

  If there is a Java SecurityManager create a Permission.

  Parameters:
    `permission` - The permission

### getJarPath

    public java.lang.String getJarPath()

  Return the JAR path.

### setJarPath

    public void setJarPath(java.lang.String jarPath)

  Change the Jar path.

### setWorkDir

    public void setWorkDir(java.io.File workDir)

  Change the work directory.

### setParentClassLoader

    protected void setParentClassLoader(java.lang.ClassLoader pcl)

  Utility method for use in subclasses. Must be called before Lifecycle methods to have any effect.

### getClearReferencesStopThreads

    public boolean getClearReferencesStopThreads()

  Return the clearReferencesStopThreads flag for this Context.

### setClearReferencesStopThreads

    public void setClearReferencesStopThreads(boolean clearReferencesStopThreads)

  Set the clearReferencesStopThreads feature for this Context.

  Parameters:
    `clearReferencesStopThreads` - The new flag value

### getClearReferencesStopTimerThreads

    public boolean getClearReferencesStopTimerThreads()

  Return the clearReferencesStopTimerThreads flag for this Context.

### setClearReferencesStopTimerThreads

    public void setClearReferencesStopTimerThreads(boolean clearReferencesStopTimerThreads)

  Set the clearReferencesStopTimerThreads feature for this Context.

  Parameters:
    `clearReferencesStopTimerThreads` - The new flag value

### getClearReferencesLogFactoryRelease

    public boolean getClearReferencesLogFactoryRelease()

  Return the clearReferencesLogFactoryRelease flag for this Context.

### setClearReferencesLogFactoryRelease

    public void setClearReferencesLogFactoryRelease(boolean clearReferencesLogFactoryRelease)

  Set the clearReferencesLogFactoryRelease feature for this Context.

  Parameters:
    `clearReferencesLogFactoryRelease` - The new flag value

### getClearReferencesThreadLocals

    public boolean getClearReferencesThreadLocals()

  Return the clearReferencesThreadLocals flag for this Context.

### setClearReferencesThreadLocals

    public void setClearReferencesThreadLocals(boolean clearReferencesThreadLocals)

  Set the clearReferencesThreadLocals feature for this Context.

  Parameters:
    `clearReferencesThreadLocals` - The new flag value

### getClearReferencesHttpClientKeepAliveThread

    public boolean getClearReferencesHttpClientKeepAliveThread()

  Return the clearReferencesHttpClientKeepAliveThread flag for this Context.

### setClearReferencesHttpClientKeepAliveThread

    public void setClearReferencesHttpClientKeepAliveThread(boolean clearReferencesHttpClientKeepAliveThread)

  Set the clearReferencesHttpClientKeepAliveThread feature for this Context.

  Parameters:
    `clearReferencesHttpClientKeepAliveThread` - The new flag value

### addRepository

    public void addRepository(java.lang.String repository)

  Add a new repository to the set of places this ClassLoader can look for classes to be loaded.

  Specified by:
    `addRepository` in interface `Reloader`
  Parameters:
    `repository` - Name of a source of classes to be loaded, such as a directory pathname, a JAR file pathname, or a ZIP file pathname
  Throws:
    `java.lang.IllegalArgumentException` - if the specified repository is invalid or does not exist

### findRepositories

    public java.lang.String[] findRepositories()

  Return a String array of the current repositories for this class loader. If there are no repositories, a zero-length array is returned.For security reason, returns a clone of the Array (since String are immutable).

  Specified by:
    `findRepositories` in interface `Reloader`

### modified

    public boolean modified()

  Have one or more classes or resources been modified so that a reload is appropriate?

  Specified by:
    `modified` in interface `Reloader`

### toString

    public java.lang.String toString()

  Render a String representation of this object.

  Overrides:
    `toString` in class `java.lang.Object`

### addURL

    protected void addURL(java.net.URL url)

  Add the specified URL to the classloader.

  Overrides:
    `addURL` in class `java.net.URLClassLoader`

### findClass

    public java.lang.Class findClass(java.lang.String name)
                              throws java.lang.ClassNotFoundException

  Find the specified class in our local repositories, if possible. If not found, throw `ClassNotFoundException`.

  Overrides:
    `findClass` in class `java.net.URLClassLoader`
  Parameters:
    `name` - Name of the class to be loaded
  Throws:
    `java.lang.ClassNotFoundException` - if the class was not found

### findResource

    public java.net.URL findResource(java.lang.String name)

  Find the specified resource in our local repository, and return a `URL` refering to it, or `null` if this resource cannot be found.

  Overrides:
    `findResource` in class `java.net.URLClassLoader`
  Parameters:
    `name` - Name of the resource to be found

### findResources

    public java.util.Enumeration findResources(java.lang.String name)
                                        throws java.io.IOException

  Return an enumeration of `URLs` representing all of the resources with the given name. If no resources with this name are found, return an empty enumeration.

  Overrides:
    `findResources` in class `java.net.URLClassLoader`
  Parameters:
    `name` - Name of the resources to be found
  Throws:
    `java.io.IOException` - if an input/output error occurs

### getResource

    public java.net.URL getResource(java.lang.String name)

  Find the resource with the given name. A resource is some data (images, audio, text, etc.) that can be accessed by class code in a way that is independent of the location of the code. The name of a resource is a "/"-separated path name that identifies the resource. If the resource cannot be found, return `null`.

  This method searches according to the following algorithm, returning as soon as it finds the appropriate URL. If the resource cannot be found, returns `null`.

  - If the `delegate` property is set to `true`, call the `getResource()` method of the parent class loader, if any.
  - Call `findResource()` to find this resource in our locally defined repositories.
  - Call the `getResource()` method of the parent class loader, if any.

  Overrides:
    `getResource` in class `java.lang.ClassLoader`
  Parameters:
    `name` - Name of the resource to return a URL for

### getResourceAsStream

    public java.io.InputStream getResourceAsStream(java.lang.String name)

  Find the resource with the given name, and return an input stream that can be used for reading it. The search order is as described for `getResource()`, after checking to see if the resource data has been previously cached. If the resource cannot be found, return `null`.

  Overrides:
    `getResourceAsStream` in class `java.lang.ClassLoader`
  Parameters:
    `name` - Name of the resource to return an input stream for

### loadClass

    public java.lang.Class loadClass(java.lang.String name)
                              throws java.lang.ClassNotFoundException

  Load the class with the specified name. This method searches for classes in the same manner as `loadClass(String, boolean)` with `false` as the second argument.

  Overrides:
    `loadClass` in class `java.lang.ClassLoader`
  Parameters:
    `name` - Name of the class to be loaded
  Throws:
    `java.lang.ClassNotFoundException` - if the class was not found

### loadClass

    public java.lang.Class loadClass(java.lang.String name,
                                     boolean resolve)
                              throws java.lang.ClassNotFoundException

  Load the class with the specified name, searching using the following algorithm until it finds and returns the class. If the class cannot be found, returns `ClassNotFoundException`.
  - Call `findLoadedClass(String)` to check if the class has already been loaded. If it has, the same `Class` object is returned.
  - If the `delegate` property is set to `true`, call the `loadClass()` method of the parent class loader, if any.
  - Call `findClass()` to find this class in our locally defined repositories.
  - Call the `loadClass()` method of our parent class loader, if any.
  If the class was found using the above steps, and the `resolve` flag is `true`, this method will then call `resolveClass(Class)` on the resulting Class object.

  Overrides:
    `loadClass` in class `java.lang.ClassLoader`
  Parameters:
    `name` - Name of the class to be loaded
    `resolve` - If `true` then resolve the class
  Throws:
    `java.lang.ClassNotFoundException` - if the class was not found

### getPermissions

    protected java.security.PermissionCollection getPermissions(java.security.CodeSource codeSource)

  Get the Permissions for a CodeSource. If this instance of WebappClassLoader is for a web application context, add read FilePermission or JndiPermissions for the base directory (if unpacked), the context URL, and jar file resources.

  Overrides:
    `getPermissions` in class `java.net.URLClassLoader`
  Parameters:
    `codeSource` - where the code was loaded from
  Returns:
    PermissionCollection for CodeSource

### check

    public boolean check(java.security.Permission permission)

  Description copied from interface: `PermissionCheck`
  Does this component have the given permission?

  Specified by:
    `check` in interface `PermissionCheck`
  Parameters:
    `permission` - The permission to test
  Returns:
    `false` if a SecurityManager is enabled and the component does not have the given permission, otherwise `true`

### getURLs

    public java.net.URL[] getURLs()

  Returns the search path of URLs for loading classes and resources. This includes the original list of URLs specified to the constructor, along with any URLs subsequently appended by the addURL() method.

  Overrides:
    `getURLs` in class `java.net.URLClassLoader`
  Returns:
    the search path of URLs for loading classes and resources.

### addLifecycleListener

    public void addLifecycleListener(LifecycleListener listener)

  Add a lifecycle event listener to this component.

  Specified by:
    `addLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to add

### findLifecycleListeners

    public LifecycleListener[] findLifecycleListeners()

  Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

  Specified by:
    `findLifecycleListeners` in interface `Lifecycle`

### removeLifecycleListener

    public void removeLifecycleListener(LifecycleListener listener)

  Remove a lifecycle event listener from this component.

  Specified by:
    `removeLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to remove

### start

    public void start()
               throws LifecycleException

  Start the class loader.

  Specified by:
    `start` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if a lifecycle error occurs

### isStarted

    public boolean isStarted()

### stop

    public void stop()
              throws LifecycleException

  Stop the class loader.

  Specified by:
    `stop` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if a lifecycle error occurs

### closeJARs

    public void closeJARs(boolean force)

  Used to periodically signal to the classloader to release JAR resources.

### clearReferences

    protected void clearReferences()

  Clear references.

### loadedByThisOrChild

    protected boolean loadedByThisOrChild(java.lang.Class clazz)

  Determine whether a class was loaded by this class loader or one of its child class loaders.

### openJARs

    protected boolean openJARs()

  Used to periodically signal to the classloader to release JAR resources.

### findClassInternal

    protected java.lang.Class findClassInternal(java.lang.String name)
                                         throws java.lang.ClassNotFoundException

  Find specified class in local repositories.

  Returns:
    the loaded class, or null if the class isn't found
  Throws:
    `java.lang.ClassNotFoundException`

### findResourceInternal

    protected ResourceEntry findResourceInternal(java.io.File file,
                                                 java.lang.String path)

  Find specified resource in local repositories.

  Returns:
    the loaded resource, or null if the resource isn't found

### findResourceInternal

    protected ResourceEntry findResourceInternal(java.lang.String name,
                                                 java.lang.String path)

  Find specified resource in local repositories.

  Returns:
    the loaded resource, or null if the resource isn't found

### isPackageSealed

    protected boolean isPackageSealed(java.lang.String name,
                                      java.util.jar.Manifest man)

  Returns true if the specified package name is sealed according to the given manifest.

### findLoadedResource

    protected java.io.InputStream findLoadedResource(java.lang.String name)

  Finds the resource with the given name if it has previously been loaded and cached by this class loader, and return an input stream to the resource data. If this resource has not been cached, return `null`.

  Parameters:
    `name` - Name of the resource to return

### findLoadedClass0

    protected java.lang.Class findLoadedClass0(java.lang.String name)

  Finds the class with the given name if it has previously been loaded and cached by this class loader, and return the Class object. If this class has not been cached, return `null`.

  Parameters:
    `name` - Name of the resource to return

### refreshPolicy

    protected void refreshPolicy()

  Refresh the system policy file, to pick up eventual changes.

### filter

    protected boolean filter(java.lang.String name)

  Filter classes.

  Parameters:
    `name` - class name
  Returns:
    true if the class should be filtered

### validate

    protected boolean validate(java.lang.String name)

  Validate a classname. As per SRV.9.7.2, we must restict loading of classes from J2SE (java.*) and classes of the servlet API (javax.servlet.*). That should enhance robustness and prevent a number of user error (where an older version of servlet.jar would be present in /WEB-INF/lib).

  Parameters:
    `name` - class name
  Returns:
    true if the name is valid

### validateJarFile

    protected boolean validateJarFile(java.io.File file)
                               throws java.io.IOException

  Check the specified JAR file, and return `true` if it does not contain any of the trigger classes.

  Parameters:
    `file` - The JAR file to be checked
  Throws:
    `java.io.IOException` - if an input/output error occurs

### getURL

    protected java.net.URL getURL(java.io.File file,
                                  boolean encoded)
                           throws java.net.MalformedURLException

  Get URL.

  Throws:
    `java.net.MalformedURLException`

### getURI

    protected java.net.URL getURI(java.io.File file)
                           throws java.net.MalformedURLException

  Get URL.

  Throws:
    `java.net.MalformedURLException`

### deleteDir

    protected static void deleteDir(java.io.File dir)

  Delete the specified directory, including all of its contents and subdirectories recursively.

  Parameters:
    `dir` - File object representing the directory to be deleted

Apache Tomcat 6.0.53

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.