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
- By default, this class loader follows the delegation model required by the
specification. The bootstrap 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 repositories. The delegate property
allows an application to modify this behavior to move the parent class loader ahead of the local repositories.
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.
Implementation Note
- No check for sealing violations or security is made unless a security manager is present.
Implementation Note
- As of 8.0, this class loader implements InstrumentableClassLoader,
permitting web application classes to instrument other classes in the same web application. It does not permit
instrumentation of system or container classes or classes in other web apps.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| protected class | |
| protected static class | |
| private class | |
| protected class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private boolean | clearReferencesHttpClientKeepAliveThread
If an HttpClient keep-alive timer thread has been started by this web application and is still running, should
Tomcat change the context class loader from the current |
| private boolean | clearReferencesLogFactoryRelease
Should Tomcat call |
| private boolean | clearReferencesObjectStreamClassCaches
Should Tomcat attempt to clear references to classes loaded by this class loader from the ObjectStreamClass caches? |
| private boolean | clearReferencesRmiTargets
Enables the RMI Target memory leak detection to be controlled. |
| private boolean | clearReferencesStopThreads
Should Tomcat attempt to terminate threads that have been started by the web application? |
| private boolean | clearReferencesStopTimerThreads
Should Tomcat attempt to terminate any |
| private boolean | clearReferencesThreadLocals
Should Tomcat attempt to clear references to classes loaded by this class loader from ThreadLocals? |
| 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)? |
| private boolean | hasExternalRepositories
Flag that indicates that |
| private final Map | |
| private ClassLoader | javaseClassLoader
The bootstrap class loader used to load the JavaSE classes. |
| private static final List | JVM_THREAD_GROUP_NAMES
List of ThreadGroup names to ignore when scanning for web application started threads that need to be shut down. |
| private static final String | |
| protected final HashMap | loaderPC
The PermissionCollection for each CodeSource for a web application context. |
| private List | localRepositories
Repositories managed by this class rather than the super class. |
| private static final Log | |
| protected final ClassLoader | parent
Hides java. |
| protected final ArrayList | permissionList
A list of read File Permission's required if this loader is for a web application context. |
| protected final Map | resourceEntries
The cache of ResourceEntry for classes and resources we have loaded, keyed by resource path, not binary name. |
| protected WebResourceRoot | resources
Associated web resources for this webapp. |
| protected final SecurityManager | securityManager
Deprecated
as a consequence of Instance of the SecurityManager installed.
SecurityManager being deprecated.
|
| private boolean | skipMemoryLeakChecksOnJvmShutdown
Should Tomcat skip the memory leak checks when the web application is stopped as part of the process of shutting down the JVM? |
| protected static final StringManager | sm
The string manager for this package. |
| private volatile LifecycleState | |
| private final List | transformers
Holds the class file transformers decorating this class loader. |
| Access | Constructor and Description |
|---|---|
| protected | WebappClassLoaderBase()
Construct a new ClassLoader with no defined repositories and no parent ClassLoader. |
| protected | WebappClassLoaderBase(ClassLoader
Our parent class loader parent)Construct a new ClassLoader with no defined repositories and the given parent ClassLoader. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addLifecycleListener(LifecycleListener
The listener to add listener)Implements org. Add a lifecycle event listener to this component. |
| pack-priv void | addPermission(URL
URL for a file or directory on local system url)If there is a Java SecurityManager create a read permission for the target of the given URL as appropriate. |
| pack-priv void | addPermission(Permission
The permission permission)If there is a Java SecurityManager create a Permission. |
| public void | addTransformer(ClassFileTransformer
The transformer to add to the class loader transformer)Implements org. Adds the specified class file transformer to this class loader. |
| protected void | addURL(URL
the URL to be added to the search path of URLs url)Overrides java. Appends the specified URL to the list of URLs to search for classes and resources. |
| private String | |
| public boolean | check(Permission
The permission to test permission)Implements org. Does this component have the given permission? |
| protected void | |
| protected void | |
| private void | checkThreadLocalMapForLeaks(Object map, Field internalTableField)
Analyzes the given thread local map object. |
| private void | |
| private void | |
| protected void | |
| private void | |
| private void | |
| private void | clearReferencesRmiTargets()
This depends on the internals of the Sun JVM so it does everything by reflection. |
| private void | |
| private void | |
| protected void | |
| public void | |
| protected final Class | |
| protected boolean | |
| public Class | findClass(String
The binary name of the class to be loaded name)Overrides java. Find the specified class in our local repositories, if possible. |
| protected Class | Returns: the loaded class, or null if the class isn't foundThe binary name of the class to be loaded name)Find specified class in local repositories. |
| public LifecycleListener[] | findLifecycleListeners()
Implements org. Get the lifecycle listeners associated with this lifecycle. |
| protected Class | Returns: a loaded classThe binary name of the resource to return name)Hides java. Finds the class with the given name if it has previously been loaded and cached by this class loader, and return the Class object. |
| public URL | findResource(final String
Name of the resource to be found name)Overrides java. Find the specified resource in our local repository, and return a |
| public Enumeration | findResources(String
Name of the resources to be found name)Overrides java. Return an enumeration of |
| public boolean | Returns: the clearReferencesHttpClientKeepAliveThread flag for this Context.
|
| public boolean | Returns: the clearReferencesLogFactoryRelease flag for this Context.
|
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | Returns: the clearReferencesStopTimerThreads flag for this Context.
|
| public boolean | |
| public String | |
| private String | |
| public boolean | Returns: true if the class lookup will delegate to the parent first. The default in Tomcat is
false.Return the "delegate first" flag for this class loader. |
| public String | getHostName()
Implements org. Returns a name for the logging system to use for the Host where the web application, if any, associated with the class loader is deployed. |
| protected ClassLoader | |
| protected PermissionCollection | Returns: PermissionCollection for CodeSourcewhere the code was loaded from codeSource)Overrides java. Get the Permissions for a CodeSource. |
| private String | |
| public URL | getResource(String
Name of the resource to return a URL for name)Overrides java. Find the resource with the given name. |
| public InputStream | getResourceAsStream(String
Name of the resource to return an input stream for name)Overrides java. Find the resource with the given name, and return an input stream that can be used for reading it. |
| public Enumeration | getResources(String
The resource name name)Overrides java. Finds all the resources with the given name. |
| public String | getServiceName()
Implements org. Returns a name for the logging system to use for the Service where the Host, if any, associated with the class loader is deployed. |
| public boolean | |
| private String | |
| public LifecycleState | Returns: The current state of the source component.Implements org. Obtain the current state of the source component. |
| public String | getStateName()
Implements org. Obtain a textual representation of the current component state. |
| private Thread[] | |
| public URL[] | getURLs()
Overrides java. Returns the search path of URLs for loading classes and resources. |
| public String | getWebappName()
Implements org. Returns a name for the logging system to use for the web application, if any, associated with the class loader. |
| public boolean | hasLoggingConfig()
Implements org. Enables JULI to determine if the web application includes a local configuration without JULI having to look for the file which it may not have permission to do when running under a SecurityManager. |
| public void | |
| protected boolean | Returns: true if the manifest associated says it is sealedPath name to check name, Manifest Associated manifest man)Returns true if the specified package name is sealed according to the given manifest. |
| private boolean | |
| public Class | loadClass(String
The binary name of the class to be loaded name)Overrides java. Load the class with the specified name. |
| public Class | loadClass(String
The binary name of the class to be loaded name, boolean If resolve)true then resolve the classOverrides java. Load the class with the specified name, searching using the following algorithm until it finds and returns the class. |
| private boolean | Returns: true if o has been loaded by the current classloader or one of its descendants.object to test, may be null o)
|
| public boolean | Returns: true if there's been a modificationHave one or more classes or resources been modified so that a reload is appropriate? |
| private String | |
| protected void | |
| public void | removeLifecycleListener(LifecycleListener
The listener to remove listener)Implements org. Remove a lifecycle event listener from this component. |
| public void | removeTransformer(ClassFileTransformer
The transformer to remove transformer)Implements org. Removes the specified class file transformer from this class loader. |
| public void | setClearReferencesHttpClientKeepAliveThread(boolean
The new flag value clearReferencesHttpClientKeepAliveThread)Set the clearReferencesHttpClientKeepAliveThread feature for this Context. |
| public void | setClearReferencesLogFactoryRelease(boolean
The new flag value clearReferencesLogFactoryRelease)Set the clearReferencesLogFactoryRelease feature for this Context. |
| public void | |
| public void | |
| public void | setClearReferencesStopThreads(boolean
The new flag value clearReferencesStopThreads)Set the clearReferencesStopThreads feature for this Context. |
| public void | setClearReferencesStopTimerThreads(boolean
The new flag value clearReferencesStopTimerThreads)Set the clearReferencesStopTimerThreads feature for this Context. |
| public void | |
| public void | setDelegate(boolean
The new "delegate first" flag delegate)Set the "delegate first" flag for this class loader. |
| protected void | |
| public void | setResources(WebResourceRoot
the resources from which the classloader will load the classes resources)Set associated resources. |
| public void | |
| public void | |
| public void | |
| public String | |
| private void |