Class WebAppProvider
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.deploy.providers.ScanningAppProvider
-
- org.eclipse.jetty.deploy.providers.WebAppProvider
-
- All Implemented Interfaces:
AppProvider
,LifeCycle
@ManagedObject("Provider for start-up deployement of webapps based on presence in directory") public class WebAppProvider 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
XmlConfiguration
format that configures aContextHandler
instance
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
- 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.
For XML configured contexts, the ID map will contain a reference to the
Server
instance called "Server" and properties for the webapp file as "jetty.webapp" and directory as "jetty.webapps".
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
WebAppProvider.Filter
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.deploy.providers.ScanningAppProvider
_filenameFilter
-
-
Constructor Summary
Constructors Constructor Description WebAppProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContextHandler
createContextHandler(App app)
Create a ContextHandler for an Appprotected void
fileAdded(java.lang.String filename)
protected void
fileChanged(java.lang.String filename)
protected void
fileRemoved(java.lang.String filename)
java.lang.String[]
getConfigurationClasses()
ConfigurationManager
getConfigurationManager()
java.lang.String
getDefaultsDescriptor()
Get the defaultsDescriptor.java.io.File
getTempDir()
Get the user supplied Work Directory.protected void
initializeWebAppContextDefaults(WebAppContext webapp)
boolean
isExtractWars()
Get the extractWars.boolean
isParentLoaderPriority()
Get the parentLoaderPriority.void
setConfigurationClasses(java.lang.String[] configurations)
void
setConfigurationManager(ConfigurationManager configurationManager)
Set the configurationManager.void
setDefaultsDescriptor(java.lang.String defaultsDescriptor)
Set the defaultsDescriptor.void
setExtractWars(boolean extractWars)
Set the extractWars.void
setParentLoaderPriority(boolean parentLoaderPriority)
Set the parentLoaderPriority.void
setTempDir(java.io.File directory)
Set the Work directory where unpacked WAR files are managed from.-
Methods inherited from class org.eclipse.jetty.deploy.providers.ScanningAppProvider
addScannerListener, createApp, doStart, doStop, exists, getDeployedApps, getDeploymentManager, getMonitoredDirName, getMonitoredDirResource, getMonitoredResources, getScanInterval, isRecursive, scan, setDeploymentManager, setFilenameFilter, setMonitoredDirectories, setMonitoredDirName, setMonitoredDirResource, setMonitoredResources, setRecursive, setScanInterval
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
-
-
-
Method Detail
-
isExtractWars
@ManagedAttribute("extract war files") public boolean isExtractWars()
Get the extractWars.- Returns:
- the extractWars
-
setExtractWars
public void setExtractWars(boolean extractWars)
Set the extractWars.- Parameters:
extractWars
- the extractWars to set
-
isParentLoaderPriority
@ManagedAttribute("parent classloader has priority") public boolean isParentLoaderPriority()
Get the parentLoaderPriority.- Returns:
- the parentLoaderPriority
-
setParentLoaderPriority
public void setParentLoaderPriority(boolean parentLoaderPriority)
Set the parentLoaderPriority.- Parameters:
parentLoaderPriority
- the parentLoaderPriority to set
-
getDefaultsDescriptor
@ManagedAttribute("default descriptor for webapps") public java.lang.String getDefaultsDescriptor()
Get the defaultsDescriptor.- Returns:
- the defaultsDescriptor
-
setDefaultsDescriptor
public void setDefaultsDescriptor(java.lang.String defaultsDescriptor)
Set the defaultsDescriptor.- Parameters:
defaultsDescriptor
- the defaultsDescriptor to set
-
getConfigurationManager
public ConfigurationManager getConfigurationManager()
-
setConfigurationManager
public void setConfigurationManager(ConfigurationManager configurationManager)
Set the configurationManager.- Parameters:
configurationManager
- the configurationManager to set
-
setConfigurationClasses
public void setConfigurationClasses(java.lang.String[] configurations)
- Parameters:
configurations
- The configuration class names.
-
getConfigurationClasses
@ManagedAttribute("configuration classes for webapps to be processed through") public java.lang.String[] getConfigurationClasses()
-
setTempDir
public void setTempDir(java.io.File directory)
Set the Work directory where unpacked WAR files are managed from.Default is the same as the
java.io.tmpdir
System Property.- Parameters:
directory
- the new work directory
-
getTempDir
@ManagedAttribute("temp directory for use, null if no user set temp directory") public java.io.File getTempDir()
Get the user supplied Work Directory.- Returns:
- the user supplied work directory (null if user has not set Temp Directory yet)
-
initializeWebAppContextDefaults
protected void initializeWebAppContextDefaults(WebAppContext webapp)
-
createContextHandler
public ContextHandler createContextHandler(App app) throws java.lang.Exception
Description copied from interface:AppProvider
Create a ContextHandler for an App- Parameters:
app
- The App- Returns:
- A ContextHandler
- Throws:
java.io.IOException
- if unable to create contextjava.lang.Exception
- if unable to create context
-
fileChanged
protected void fileChanged(java.lang.String filename) throws java.lang.Exception
- Overrides:
fileChanged
in classScanningAppProvider
- Throws:
java.lang.Exception
-
fileAdded
protected void fileAdded(java.lang.String filename) throws java.lang.Exception
- Overrides:
fileAdded
in classScanningAppProvider
- Throws:
java.lang.Exception
-
fileRemoved
protected void fileRemoved(java.lang.String filename) throws java.lang.Exception
- Overrides:
fileRemoved
in classScanningAppProvider
- Throws:
java.lang.Exception
-
-