Class ContextProvider
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.deploy.providers.ScanningAppProvider
org.eclipse.jetty.deploy.providers.ContextProvider
- All Implemented Interfaces:
AppProvider, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle
@ManagedObject("Provider for start-up deployment of webapps based on presence in directory")
public class ContextProvider
extends ScanningAppProvider
The webapps directory scanning provider.
This provider scans one or more directories (typically "webapps") for contexts to deploy, which may be:
- A standard WAR file (must end in ".war")
- A directory containing an expanded WAR file
- A directory containing static content
- An XML descriptor in
XmlConfigurationformat that configures aContextHandlerinstance
To avoid double deployments and allow flexibility of the content of the scanned directories, the provider implements some heuristics to ignore some files found in the scans:
- Hidden files (starting with ".") are ignored
- Directories with names ending in ".d" are ignored
- Property files with names ending in ".properties" are not deployed.
- If a directory and a WAR file exist ( eg foo/ and foo.war) then the directory is assumed to be the unpacked WAR and only the WAR is deployed (which may reused the unpacked directory)
- If a directory and a matching XML file exist ( eg foo/ and foo.xml) then the directory is assumed to be an unpacked WAR and only the XML is deployed (which may used the directory in it's configuration)
- If a WAR file and a matching XML exist (eg foo.war and foo.xml) then the WAR is assumed to be configured by the XML and only the XML is deployed.
Only Apps discovered that report App.getEnvironmentName() matching this providers
ScanningAppProvider.getEnvironmentName() will be deployed.
For XML configured contexts, the ID map will contain a reference to the Server instance called "Server" and
properties for the webapp file such as "jetty.webapp" and directory as "jetty.webapps".
The properties will be initialized with:
- The properties set on the application via
App.getProperties(); otherwise: - The properties set on this provider via
getProperties()
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectcreateContextHandler(App app) Create a ContextHandler for an Appprotected ClassLoaderString[]This is equivalent to getting theDeployable.CONFIGURATION_CLASSESproperty.Get the defaultsDescriptor.protected ContextHandlerprotected voidinitializeContextPath(ContextHandler context, Path path) protected booleanisDeployable(Path path) booleanGet the extractWars.booleanGet the parentLoaderPriority.voidloadProperties(Resource resource) voidloadPropertiesFromPath(Path path) voidprotected voidprotected voidpathChanged(Path path) voidsetConfigurationClasses(String configurations) This is equivalent to setting theDeployable.CONFIGURATION_CLASSESproperty.voidsetConfigurationClasses(String[] configurations) This is equivalent to setting theDeployable.CONFIGURATION_CLASSESproperty.voidsetDefaultsDescriptor(String defaultsDescriptor) Set the defaultsDescriptor.voidsetExtractWars(boolean extractWars) Set the extractWars.voidsetParentLoaderPriority(boolean parentLoaderPriority) Set the parentLoaderPriority.Methods inherited from class ScanningAppProvider
addScannerListener, createApp, doStart, doStop, exists, getDeployedApps, getDeploymentManager, getEnvironmentName, getMonitoredDirName, getMonitoredDirResource, getMonitoredResources, getScanInterval, isDeferInitialScan, isUseRealPaths, pathRemoved, scan, setDeferInitialScan, setDeploymentManager, setEnvironmentName, setFilenameFilter, setMonitoredDirectories, setMonitoredDirName, setMonitoredDirResource, setMonitoredResources, setScanInterval, setUseRealPaths, toStringMethods inherited from class ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Container
getCachedBeans, getEventListenersMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Constructor Details
-
ContextProvider
public ContextProvider()
-
-
Method Details
-
getProperties
-
loadProperties
- Throws:
IOException
-
loadPropertiesFromPath
- Throws:
IOException
-
loadPropertiesFromString
- Throws:
IOException
-
isExtractWars
Get the extractWars. This is equivalent to getting theDeployable.EXTRACT_WARSproperty.- Returns:
- the extractWars
-
setExtractWars
public void setExtractWars(boolean extractWars) Set the extractWars. This is equivalent to setting theDeployable.EXTRACT_WARSproperty.- Parameters:
extractWars- the extractWars to set
-
isParentLoaderPriority
Get the parentLoaderPriority. This is equivalent to getting theDeployable.PARENT_LOADER_PRIORITYproperty.- Returns:
- the parentLoaderPriority
-
setParentLoaderPriority
public void setParentLoaderPriority(boolean parentLoaderPriority) Set the parentLoaderPriority. This is equivalent to setting theDeployable.PARENT_LOADER_PRIORITYproperty.- Parameters:
parentLoaderPriority- the parentLoaderPriority to set
-
getDefaultsDescriptor
Get the defaultsDescriptor. This is equivalent to getting theDeployable.DEFAULTS_DESCRIPTORproperty.- Returns:
- the defaultsDescriptor
-
setDefaultsDescriptor
Set the defaultsDescriptor. This is equivalent to setting theDeployable.DEFAULTS_DESCRIPTORproperty.- Parameters:
defaultsDescriptor- the defaultsDescriptor to set
-
setConfigurationClasses
This is equivalent to setting theDeployable.CONFIGURATION_CLASSESproperty.- Parameters:
configurations- The configuration class names as a comma separated list
-
setConfigurationClasses
This is equivalent to setting theDeployable.CONFIGURATION_CLASSESproperty.- Parameters:
configurations- The configuration class names.
-
getConfigurationClasses
@ManagedAttribute("configuration classes for webapps to be processed through") public String[] getConfigurationClasses()This is equivalent to getting theDeployable.CONFIGURATION_CLASSESproperty.- Returns:
- The configuration class names.
-
initializeContextHandler
-
createContextHandler
Description copied from interface:AppProviderCreate a ContextHandler for an App- Parameters:
app- The App- Returns:
- A ContextHandler
- Throws:
Exception- if unable to create context
-
applyXml
-
findCoreContextClassLoader
- Throws:
IOException
-
initializeContextPath
-
isDeployable
-
pathAdded
- Overrides:
pathAddedin classScanningAppProvider- Throws:
Exception
-
pathChanged
- Overrides:
pathChangedin classScanningAppProvider- Throws:
Exception
-