WebappClassLoaderBase (Apache Tomcat 7.0.104 API Documentation)

org.apache.catalina.loader

## Class WebappClassLoaderBase

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

- All Implemented Interfaces:
    Closeable, AutoCloseable, Lifecycle, InstrumentableClassLoader, PermissionCheck
  Direct Known Subclasses:
    ParallelWebappClassLoader, WebappClassLoader

      public abstract class WebappClassLoaderBase
      extends URLClassLoader
      implements Lifecycle, InstrumentableClassLoader, 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 - By default, this class loader follows the delegation model required by 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 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 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.

  TODO: Is there any requirement to provide a proper Lifecycle implementation rather than the current stubbed implementation? IMPLEMENTATION NOTE - As of 7.0.64/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.

  Author:
    Remy Maucherat, Craig R. McClanahan

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `WebappClassLoaderBase.PrivilegedFindResourceByName`
    `protected static class` | `WebappClassLoaderBase.PrivilegedGetClassLoader`

    - ### Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle

      `Lifecycle.SingleUse`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Permission` | `allPermission` All permission.
    `protected 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)?
    `protected 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 ClassLoader` | `j2seClassLoader` The bootstrap class loader used to load the JavaSE classes.
    `protected JarFile[]` | `jarFiles` The list of JARs, in the order they should be searched for locally loaded classes or resources.
    `protected String[]` | `jarNames` The list of JARs, in the order they should be searched for locally loaded classes or resources.
    `protected int` | `jarOpenInterval` The interval in milliseconds that we can keep jar files open.
    `protected String` | `jarPath` The path which will be monitored for added Jar files.
    `protected 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 File` | `loaderDir` Path where resources loaded from JARs will be extracted.
    `protected HashMap<String,PermissionCollection>` | `loaderPC` The PermissionCollection for each CodeSource for a web application context.
    `protected boolean` | `needConvert` need conversion for properties files
    `protected HashMap<String,String>` | `notFoundResources` The list of not found resources.
    `protected static String[]` | `packageTriggers` Set of package names which are not allowed to be loaded from a webapp class loader without delegating first.
    `protected ClassLoader` | `parent` The parent class loader.
    `protected String[]` | `paths` The list of resources which should be checked when checking for modifications.
    `protected ArrayList<Permission>` | `permissionList` A list of read File and Jndi Permission's required if this loader is for a web application context.
    `protected String[]` | `repositories` The list of local repositories, in the order they should be searched for locally loaded classes or resources.
    `protected URL[]` | `repositoryURLs` Repositories URLs, used to cache the result of getURLs.
    `protected Map<String,ResourceEntry>` | `resourceEntries` The cache of ResourceEntry for classes and resources we have loaded, keyed by resource path, not binary name.
    `protected DirContext` | `resources` Associated directory context giving access to the resources in this webapp.
    `protected boolean` | `searchExternalFirst` Search external repositories first
    `protected SecurityManager` | `securityManager` Instance of the SecurityManager installed.
    `protected static StringManager` | `sm`
    `protected boolean` | `started` Has this component been started?
    `protected ClassLoader` | `system` Deprecated. Unused. Always null. Will be removed in 8.0.x.
    `protected static 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_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebappClassLoaderBase()` Construct a new ClassLoader with no defined repositories and no parent ClassLoader.
    `WebappClassLoaderBase(ClassLoader parent)` Construct a new ClassLoader with no defined repositories and the given parent ClassLoader.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addLifecycleListener(LifecycleListener listener)` Add a lifecycle event listener to this component.
    `void` | `addPermission(Permission permission)` If there is a Java SecurityManager create a Permission.
    `void` | `addPermission(String filepath)` If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path.
    `void` | `addPermission(URL url)` If there is a Java SecurityManager create a read FilePermission or JndiPermission for URL.
    `void` | `addRepository(String repository)` Add a new repository to the set of places this ClassLoader can look for classes to be loaded.
    `void` | `addTransformer(ClassFileTransformer transformer)` Adds the specified class file transformer to this class loader.
    `protected void` | `addURL(URL url)` Add the specified URL to the classloader.
    `boolean` | `check(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 void` | `copyStateWithoutTransformers(WebappClassLoaderBase base)`
    `protected static void` | `deleteDir(File dir)` Delete the specified directory, including all of its contents and subdirectories recursively.
    `void` | `destroy()` Prepare to discard the object.
    `protected Class<?>` | `doDefineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain)` Expose this method for use by the unit tests.
    `protected boolean` | `filter(String name)` Filter classes.
    `Class<?>` | `findClass(String name)` Find the specified class in our local repositories, if possible.
    `protected Class<?>` | `findClassInternal(String name)` Find specified class in local repositories.
    `LifecycleListener[]` | `findLifecycleListeners()` Get the lifecycle listeners associated with this lifecycle.
    `protected Class<?>` | `findLoadedClass0(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 InputStream` | `findLoadedResource(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.
    `String[]` | `findRepositories()` Return a String array of the current repositories for this class loader.
    `URL` | `findResource(String name)` Find the specified resource in our local repository, and return a `URL` referring to it, or `null` if this resource cannot be found.
    `protected ResourceEntry` | `findResourceInternal(File file, String path)` Find specified resource in local repositories.
    `protected ResourceEntry` | `findResourceInternal(String name, String path, boolean manifestRequired)` Find specified resource in local repositories.
    `Enumeration<URL>` | `findResources(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` | `getClearReferencesObjectStreamClassCaches()`
    `boolean` | `getClearReferencesRmiTargets()`
    `boolean` | `getClearReferencesStatic()` Deprecated. Will be removed in 8.5
    `boolean` | `getClearReferencesStopThreads()` Return the clearReferencesStopThreads flag for this Context.
    `boolean` | `getClearReferencesStopTimerThreads()` Return the clearReferencesStopTimerThreads flag for this Context.
    `boolean` | `getClearReferencesThreadLocals()`
    `String` | `getContextName()` Return the context name for this class loader.
    `boolean` | `getDelegate()` Return the "delegate first" flag for this class loader.
    `int` | `getJarOpenInterval()` Return the interval to keep all jar files open if no jar is accessed
    `String` | `getJarPath()` Return the JAR path.
    `protected ClassLoader` | `getJavaseClassLoader()`
    `protected PermissionCollection` | `getPermissions(CodeSource codeSource)` Get the Permissions for a CodeSource.
    `URL` | `getResource(String name)` Find the resource with the given name.
    `InputStream` | `getResourceAsStream(String name)` Find the resource with the given name, and return an input stream that can be used for reading it.
    `DirContext` | `getResources()` Get associated resources.
    `Enumeration<URL>` | `getResources(String name)`
    `boolean` | `getSearchExternalFirst()`
    `LifecycleState` | `getState()` Obtain the current state of the source component.
    `String` | `getStateName()` Obtain a textual representation of the current component state.
    `protected URL` | `getURI(File file)` Get the URI for the given file.
    `protected URL` | `getURL(File file, boolean encoded)` Deprecated. Use `getURI(File)` instead
    `URL[]` | `getURLs()` Returns the search path of URLs for loading classes and resources.
    `void` | `init()` Prepare the component for starting.
    `protected boolean` | `isPackageSealed(String name, Manifest man)` Returns true if the specified package name is sealed according to the given manifest.
    `boolean` | `isStarted()`
    `Class<?>` | `loadClass(String name)` Load the class with the specified name.
    `Class<?>` | `loadClass(String name, boolean resolve)` Load the class with the specified name, searching using the following algorithm until it finds and returns the class.
    `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` | `removeTransformer(ClassFileTransformer transformer)` Removes the specified class file transformer from this class loader.
    `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` | `setClearReferencesObjectStreamClassCaches(boolean clearReferencesObjectStreamClassCaches)`
    `void` | `setClearReferencesRmiTargets(boolean clearReferencesRmiTargets)`
    `void` | `setClearReferencesStatic(boolean clearReferencesStatic)` Deprecated. Will be removed in 8.5
    `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)`
    `void` | `setDelegate(boolean delegate)` Set the "delegate first" flag for this class loader.
    `void` | `setJarOpenInterval(int jarOpenInterval)` Set the interval to keep all jar files open
    `void` | `setJarPath(String jarPath)` Change the Jar path.
    `protected void` | `setJavaseClassLoader(ClassLoader classLoader)`
    `protected void` | `setParentClassLoader(ClassLoader pcl)` Deprecated. Will be removed in 8.0.x onwards.
    `void` | `setResources(DirContext resources)` Set associated resources.
    `void` | `setSearchExternalFirst(boolean searchExternalFirst)`
    `void` | `setWorkDir(File workDir)` Change the work directory.
    `void` | `start()` Start the class loader.
    `void` | `stop()` Stop the class loader.
    `String` | `toString()` Render a String representation of this object.
    `protected boolean` | `validate(String name)` Validate a classname.
    `protected boolean` | `validateJarFile(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

      `close, 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, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.tomcat.InstrumentableClassLoader

      `copyWithoutTransformers`

- - ### Field Detail

    - #### sm

          protected static final StringManager sm

    - #### triggers

          protected static final 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 String[] packageTriggers

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

    - #### resources

          protected DirContext resources

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

    - #### resourceEntries

          protected Map<String,ResourceEntry> resourceEntries

      The cache of ResourceEntry for classes and resources we have loaded, keyed by resource path, not binary name. Path is used as the key since resources may be requested by binary name (classes) or path (other resources such as property files) and the mapping from binary name to path is unambiguous but the reverse mapping is ambiguous.

    - #### notFoundResources

          protected HashMap<String,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. Note that the default, `false`, is the behavior called for by the servlet specification.

    - #### lastJarAccessed

          protected long lastJarAccessed

      Last time a JAR was accessed.

    - #### jarOpenInterval

          protected int jarOpenInterval

      The interval in milliseconds that we can keep jar files open.

    - #### repositories

          protected String[] repositories

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

    - #### repositoryURLs

          protected URL[] repositoryURLs

      Repositories URLs, used to cache the result of getURLs.

    - #### files

          protected 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 JarFile[] jarFiles

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

    - #### jarRealFiles

          protected File[] jarRealFiles

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

    - #### jarPath

          protected String jarPath

      The path which will be monitored for added Jar files.

    - #### jarNames

          protected 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 String[] paths

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

    - #### permissionList

          protected ArrayList<Permission> permissionList

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

    - #### loaderDir

          protected File loaderDir

      Path where resources loaded from JARs will be extracted.

    - #### canonicalLoaderDir

          protected String canonicalLoaderDir

    - #### loaderPC

          protected HashMap<String,PermissionCollection> loaderPC

      The PermissionCollection for each CodeSource for a web application context.

    - #### securityManager

          protected SecurityManager securityManager

      Instance of the SecurityManager installed.

    - #### parent

          protected ClassLoader parent

      The parent class loader.

    - #### system

          @Deprecated
          protected ClassLoader system

      Deprecated. Unused. Always null. Will be removed in 8.0.x.
      The system class loader.

    - #### j2seClassLoader

          protected ClassLoader j2seClassLoader

      The bootstrap class loader used to load the JavaSE classes. In some implementations this class loader is always `null` and in those cases `ClassLoader.getParent()` will be called recursively on the system class loader and the last non-null result used.

    - #### 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 Permission allPermission

      All permission.

  - ### Constructor Detail

    - #### WebappClassLoaderBase

          public WebappClassLoaderBase()

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

    - #### WebappClassLoaderBase

          public WebappClassLoaderBase(ClassLoader parent)

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

      Method is used via reflection - see `WebappLoader.createClassLoader()`

      Parameters:
        `parent` - Our parent class loader

  - ### Method Detail

    - #### getResources

          public DirContext getResources()

      Get associated resources.

    - #### setResources

          public void setResources(DirContext resources)

      Set associated resources.

    - #### getContextName

          public 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. If this flag is true, this class loader delegates to the parent class loader before searching its own repositories, as in an ordinary (non-servlet) chain of Java class loaders. If set to `false` (the default), this class loader will search its own repositories first, and delegate to the parent only if the class or resource is not found locally, as per the servlet specification.
      Parameters:
        `delegate` - The new "delegate first" flag

    - #### setJarOpenInterval

          public void setJarOpenInterval(int jarOpenInterval)

      Set the interval to keep all jar files open
      Parameters:
        `jarOpenInterval` - the interval in milliseconds to keep jar files open

    - #### getJarOpenInterval

          public int getJarOpenInterval()

      Return the interval to keep all jar files open if no jar is accessed

    - #### 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(String filepath)

      If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path.
      Parameters:
        `filepath` - file directory path

    - #### addPermission

          public void addPermission(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(Permission permission)

      If there is a Java SecurityManager create a Permission.
      Parameters:
        `permission` - The permission

    - #### getJarPath

          public String getJarPath()

      Return the JAR path.

    - #### setJarPath

          public void setJarPath(String jarPath)

      Change the Jar path.

    - #### setWorkDir

          public void setWorkDir(File workDir)

      Change the work directory.

    - #### setParentClassLoader

          @Deprecated
          protected void setParentClassLoader(ClassLoader pcl)

      Deprecated. Will be removed in 8.0.x onwards.
      Utility method for use in subclasses. Must be called before Lifecycle methods to have any effect.

    - #### getClearReferencesStatic

          @Deprecated
          public boolean getClearReferencesStatic()

      Deprecated. Will be removed in 8.5
      Return the clearReferencesStatic flag for this Context.

    - #### setClearReferencesStatic

          @Deprecated
          public void setClearReferencesStatic(boolean clearReferencesStatic)

      Deprecated. Will be removed in 8.5
      Set the clearReferencesStatic feature for this Context.
      Parameters:
        `clearReferencesStatic` - The new flag value

    - #### 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

    - #### 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

    - #### getClearReferencesObjectStreamClassCaches

          public boolean getClearReferencesObjectStreamClassCaches()

    - #### setClearReferencesObjectStreamClassCaches

          public void setClearReferencesObjectStreamClassCaches(boolean clearReferencesObjectStreamClassCaches)

    - #### getClearReferencesThreadLocals

          public boolean getClearReferencesThreadLocals()

    - #### setClearReferencesThreadLocals

          public void setClearReferencesThreadLocals(boolean clearReferencesThreadLocals)

    - #### addTransformer

          public void addTransformer(ClassFileTransformer transformer)

      Adds the specified class file transformer to this class loader. The transformer will then be able to modify the bytecode of any classes loaded by this class loader after the invocation of this method.
      Specified by:
        `addTransformer` in interface `InstrumentableClassLoader`
      Parameters:
        `transformer` - The transformer to add to the class loader

    - #### removeTransformer

          public void removeTransformer(ClassFileTransformer transformer)

      Removes the specified class file transformer from this class loader. It will no longer be able to modify the byte code of any classes loaded by the class loader after the invocation of this method. However, any classes already modified by this transformer will remain transformed.
      Specified by:
        `removeTransformer` in interface `InstrumentableClassLoader`
      Parameters:
        `transformer` - The transformer to remove

    - #### copyStateWithoutTransformers

          protected void copyStateWithoutTransformers(WebappClassLoaderBase base)

    - #### addRepository

          public void addRepository(String repository)

      Add a new repository to the set of places this ClassLoader can look for classes to be loaded.
      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:
        `IllegalArgumentException` - if the specified repository is invalid or does not exist

    - #### findRepositories

          public 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).

    - #### modified

          public boolean modified()

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

    - #### toString

          public String toString()

      Render a String representation of this object.
      Overrides:
        `toString` in class `Object`

    - #### addURL

          protected void addURL(URL url)

      Add the specified URL to the classloader.
      Overrides:
        `addURL` in class `URLClassLoader`

    - #### doDefineClass

          protected final Class<?> doDefineClass(String name,
                               byte[] b,
                               int off,
                               int len,
                               ProtectionDomain protectionDomain)

      Expose this method for use by the unit tests.

    - #### findClass

          public Class<?> findClass(String name)
                             throws ClassNotFoundException

      Find the specified class in our local repositories, if possible. If not found, throw `ClassNotFoundException`.
      Overrides:
        `findClass` in class `URLClassLoader`
      Parameters:
        `name` - Name of the class to be loaded
      Throws:
        `ClassNotFoundException` - if the class was not found

    - #### findResource

          public URL findResource(String name)

      Find the specified resource in our local repository, and return a `URL` referring to it, or `null` if this resource cannot be found.
      Overrides:
        `findResource` in class `URLClassLoader`
      Parameters:
        `name` - Name of the resource to be found

    - #### findResources

          public Enumeration<URL> findResources(String name)
                                         throws 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 `URLClassLoader`
      Parameters:
        `name` - Name of the resources to be found
      Throws:
        `IOException` - if an input/output error occurs

    - #### getResource

          public URL getResource(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 `ClassLoader`
      Parameters:
        `name` - Name of the resource to return a URL for

    - #### getResources

          public Enumeration<URL> getResources(String name)
                                        throws IOException

      Overrides:
        `getResources` in class `ClassLoader`
      Throws:
        `IOException`

    - #### getResourceAsStream

          public InputStream getResourceAsStream(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 `URLClassLoader`
      Parameters:
        `name` - Name of the resource to return an input stream for

    - #### loadClass

          public Class<?> loadClass(String name)
                             throws 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 `ClassLoader`
      Parameters:
        `name` - Name of the class to be loaded
      Throws:
        `ClassNotFoundException` - if the class was not found

    - #### loadClass

          public Class<?> loadClass(String name,
                           boolean resolve)
                             throws 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 `ClassLoader`
      Parameters:
        `name` - Name of the class to be loaded
        `resolve` - If `true` then resolve the class
      Throws:
        `ClassNotFoundException` - if the class was not found

    - #### getPermissions

          protected PermissionCollection getPermissions(CodeSource codeSource)

      Get the Permissions for a CodeSource. If this instance of WebappClassLoaderBase 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 `URLClassLoader`
      Parameters:
        `codeSource` - where the code was loaded from
      Returns:
        PermissionCollection for CodeSource

    - #### check

          public boolean check(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 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 `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`
      Returns:
        An array containing the life cycle listeners associated with this life cycle. If this component has no listeners registered, a zero-length array is returned.

    - #### 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

    - #### getState

          public LifecycleState getState()

      Obtain the current state of the source component.
      Specified by:
        `getState` in interface `Lifecycle`
      Returns:
        The current state of the source component.

    - #### getStateName

          public String getStateName()

      Obtain a textual representation of the current component state. Useful for JMX. The format of this string may vary between point releases and should not be relied upon to determine component state. To determine component state, use `Lifecycle.getState()`.
      Specified by:
        `getStateName` in interface `Lifecycle`
      Returns:
        The name of the current component state.

    - #### init

          public void init()

      Description copied from interface: `Lifecycle`
      Prepare the component for starting. This method should perform any initialization required post object creation. The following `LifecycleEvent`s will be fired in the following order:
      1. INIT_EVENT: On the successful completion of component initialization.
      Specified by:
        `init` in interface `Lifecycle`

    - #### 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

    - #### destroy

          public void destroy()

      Description copied from interface: `Lifecycle`
      Prepare to discard the object. The following `LifecycleEvent`s will be fired in the following order:
      1. DESTROY_EVENT: On the successful completion of component destruction.
      Specified by:
        `destroy` in interface `Lifecycle`

    - #### closeJARs

          public void closeJARs(boolean force)

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

    - #### getJavaseClassLoader

          protected ClassLoader getJavaseClassLoader()

    - #### setJavaseClassLoader

          protected void setJavaseClassLoader(ClassLoader classLoader)

    - #### clearReferences

          protected void clearReferences()

      Clear references.

    - #### openJARs

          protected boolean openJARs()

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

    - #### findClassInternal

          protected Class<?> findClassInternal(String name)
                                        throws ClassNotFoundException

      Find specified class in local repositories.
      Returns:
        the loaded class, or null if the class isn't found
      Throws:
        `ClassNotFoundException`

    - #### findResourceInternal

          protected ResourceEntry findResourceInternal(File file,
                                           String path)

      Find specified resource in local repositories.
      Returns:
        the loaded resource, or null if the resource isn't found

    - #### findResourceInternal

          protected ResourceEntry findResourceInternal(String name,
                                           String path,
                                           boolean manifestRequired)

      Find specified resource in local repositories.
      Returns:
        the loaded resource, or null if the resource isn't found

    - #### isPackageSealed

          protected boolean isPackageSealed(String name,
                                Manifest man)

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

    - #### findLoadedResource

          protected InputStream findLoadedResource(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 Class<?> findLoadedClass0(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(String name)

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

    - #### validate

          protected boolean validate(String name)

      Validate a classname. As per SRV.9.7.2, we must restrict loading of classes from J2SE (java.*) and most 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(File file)
                                     throws 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:
        `IOException` - if an input/output error occurs

    - #### getURL

          @Deprecated
          protected URL getURL(File file,
                              boolean encoded)
                        throws MalformedURLException

      Deprecated. Use `getURI(File)` instead
      Get URL.
      Throws:
        `MalformedURLException`

    - #### getURI

          protected URL getURI(File file)
                        throws MalformedURLException

      Get the URI for the given file.
      Throws:
        `MalformedURLException`

    - #### deleteDir

          protected static void deleteDir(File dir)

      Delete the specified directory, including all of its contents and subdirectories recursively.
      Parameters:
        `dir` - File object representing the directory to be deleted

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