org.wso2.carbon.webapp.mgt.loader

## Class CarbonWebappClassLoader

- java.lang.Object
- - java.lang.ClassLoader
  - - java.security.SecureClassLoader
    - - java.net.URLClassLoader
      - - org.apache.catalina.loader.WebappClassLoaderBase
        - - org.apache.catalina.loader.WebappClassLoader
          - - org.wso2.carbon.webapp.mgt.loader.CarbonWebappClassLoader

- All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.catalina.Lifecycle, org.apache.tomcat.InstrumentableClassLoader

      public class CarbonWebappClassLoader
      extends org.apache.catalina.loader.WebappClassLoader

  Customized WebappClassloader for Carbon. This class introduces a new classloading pattern which is based on the webapp-classloading.xml file. The default behaviour is specified in the container level configuration file. But webapps has the ability to override that behaviour by adding the customised webapp-classloading.xml file into the webapp.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.catalina.loader.WebappClassLoaderBase

      `org.apache.catalina.loader.WebappClassLoaderBase.PrivilegedFindResourceByName, org.apache.catalina.loader.WebappClassLoaderBase.PrivilegedGetClassLoader`

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

      `org.apache.catalina.Lifecycle.SingleUse`

  - ### Field Summary

    - ### Fields inherited from class org.apache.catalina.loader.WebappClassLoaderBase

      `allPermission, canonicalLoaderDir, delegate, files, hasExternalRepositories, j2seClassLoader, jarFiles, jarNames, jarPath, jarRealFiles, lastJarAccessed, lastModifiedDates, loaderDir, loaderPC, needConvert, notFoundResources, packageTriggers, parent, paths, permissionList, repositories, repositoryURLs, resourceEntries, resources, searchExternalFirst, securityManager, sm, started, system, triggers`

    - ### 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
    `CarbonWebappClassLoader(ClassLoader parent)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Class<?>` | `findClassFromParent(String name, boolean resolve)`
    `protected Class<?>` | `findLocalClass(String name, boolean resolve)`
    `InputStream` | `getResourceAsStream(String name)`
    `Enumeration<URL>` | `getResources(String name)`
    `Class<?>` | `loadClass(String name, boolean resolve)`
    `void` | `setWebappCC(WebappClassloadingContext classloadingContext)`

    - ### Methods inherited from class org.apache.catalina.loader.WebappClassLoader

      `copyWithoutTransformers`

    - ### Methods inherited from class org.apache.catalina.loader.WebappClassLoaderBase

      `addLifecycleListener, addPermission, addPermission, addPermission, addRepository, addTransformer, addURL, clearReferences, closeJARs, copyStateWithoutTransformers, deleteDir, destroy, doDefineClass, filter, findClass, findClassInternal, findLifecycleListeners, findLoadedClass0, findLoadedResource, findRepositories, findResource, findResourceInternal, findResourceInternal, findResources, getAntiJARLocking, getClearReferencesHttpClientKeepAliveThread, getClearReferencesLogFactoryRelease, getClearReferencesStatic, getClearReferencesStopThreads, getClearReferencesStopTimerThreads, getContextName, getDelegate, getJarPath, getJavaseClassLoader, getPermissions, getResource, getResources, getSearchExternalFirst, getState, getStateName, getURI, getURL, getURLs, init, isPackageSealed, isStarted, loadClass, modified, openJARs, refreshPolicy, removeLifecycleListener, removeTransformer, setAntiJARLocking, setClearReferencesHttpClientKeepAliveThread, setClearReferencesLogFactoryRelease, setClearReferencesStatic, setClearReferencesStopThreads, setClearReferencesStopTimerThreads, setDelegate, setJarPath, setJavaseClassLoader, setParentClassLoader, setResources, setSearchExternalFirst, setWorkDir, start, stop, toString, validate, validateJarFile`

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

- - ### Constructor Detail

    - #### CarbonWebappClassLoader

          public CarbonWebappClassLoader(ClassLoader parent)

  - ### Method Detail

    - #### setWebappCC

          public void setWebappCC(WebappClassloadingContext classloadingContext)

    - #### loadClass

          public Class<?> loadClass(String name,
                                    boolean resolve)
                             throws ClassNotFoundException

      Overrides:
        `loadClass` in class `org.apache.catalina.loader.WebappClassLoaderBase`
      Throws:
        `ClassNotFoundException`

    - #### findClassFromParent

          protected Class<?> findClassFromParent(String name,
                                                 boolean resolve)
                                          throws ClassNotFoundException

      Throws:
        `ClassNotFoundException`

    - #### findLocalClass

          protected Class<?> findLocalClass(String name,
                                            boolean resolve)
                                     throws ClassNotFoundException

      Throws:
        `ClassNotFoundException`

    - #### getResourceAsStream

          public InputStream getResourceAsStream(String name)

      Overrides:
        `getResourceAsStream` in class `org.apache.catalina.loader.WebappClassLoaderBase`

    - #### getResources

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

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

Copyright © 2019 WSO2. All rights reserved.