org.apache.catalina.loader

## Class VirtualWebappLoader

- java.lang.Object
- - org.apache.catalina.util.LifecycleBase
  - - org.apache.catalina.util.LifecycleMBeanBase
    - - org.apache.catalina.loader.WebappLoader
      - - org.apache.catalina.loader.VirtualWebappLoader

All Implemented Interfaces:
  PropertyChangeListener, EventListener, MBeanRegistration, Lifecycle, Loader

    public class VirtualWebappLoader
    extends WebappLoader

A WebappLoader that allows a customized classpath to be added through configuration in context xml. Any additional classpath entry will be added to the default webapp classpath, making easy to emulate a standard webapp without the need for assembly all the webapp dependencies as jars in WEB-INF/lib.

     <Context docBase="\webapps\mydocbase">
       <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
                  virtualClasspath="/dir/classes;/somedir/somejar.jar;
                    /somedir/*.jar"/>
     </Context>

The `*.jar` suffix can be used to include all JAR files in a certain directory. If a file or a directory does not exist, it will be skipped.

Author:
  Fabrizio Giustina

### Field Summary

### Fields inherited from class org.apache.catalina.loader.WebappLoader

`sm, support`

### Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase

`mserver`

### 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
`VirtualWebappLoader()` Construct a new WebappLoader with no defined parent class loader (so that the actual parent will be the system class loader).
`VirtualWebappLoader(ClassLoader parent)` Construct a new WebappLoader with the specified class loader to be defined as the parent of the ClassLoader we ultimately create.

### Method Summary

Methods
`boolean` `getSearchVirtualFirst()`
`void` `setSearchVirtualFirst(boolean searchVirtualFirst)`
`void` `setVirtualClasspath(String path)` `virtualClasspath` attribute that will be automatically set from the `Context` `virtualClasspath` attribute from the context xml file.
`protected void` `startInternal()` Implement the requirements of `LifecycleBase.startInternal()`.

### Methods inherited from class org.apache.catalina.loader.WebappLoader

`addPropertyChangeListener, addRepository, backgroundProcess, closeJARs, findRepositories, getClassLoader, getClasspath, getContainer, getDelegate, getDomainInternal, getInfo, getLoaderClass, getLoaderRepositories, getLoaderRepositoriesString, getObjectNameKeyProperties, getReloadable, getRepositories, getRepositoriesString, getSearchExternalFirst, modified, propertyChange, removePropertyChangeListener, setContainer, setDelegate, setLoaderClass, setReloadable, setSearchExternalFirst, stopInternal, toString`

### Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase

`destroyInternal, getDomain, getObjectName, initInternal, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister`

### Methods inherited from class org.apache.catalina.util.LifecycleBase

`addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop`

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

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

### Constructor Detail

#### VirtualWebappLoader

    public VirtualWebappLoader()

Construct a new WebappLoader with no defined parent class loader (so that the actual parent will be the system class loader).

#### VirtualWebappLoader

    public VirtualWebappLoader(ClassLoader parent)

Construct a new WebappLoader with the specified class loader to be defined as the parent of the ClassLoader we ultimately create.

Parameters:
  `parent` - The parent class loader

### Method Detail

#### setVirtualClasspath

    public void setVirtualClasspath(String path)

`virtualClasspath` attribute that will be automatically set from the `Context` `virtualClasspath` attribute from the context xml file.

Parameters:
  `path` - `;` separated list of path elements.

#### getSearchVirtualFirst

    public boolean getSearchVirtualFirst()

Returns:
  Returns searchVirtualFirst.

#### setSearchVirtualFirst

    public void setSearchVirtualFirst(boolean searchVirtualFirst)

Parameters:
  `searchVirtualFirst` - Whether the virtual class path should be searched before the webapp

#### startInternal

    protected void startInternal()
                          throws LifecycleException

Implement the requirements of `LifecycleBase.startInternal()`.

Overrides:
  `startInternal` in class `WebappLoader`
Throws:
  `LifecycleException` - if this component detects a fatal error that prevents this component from being used