Class 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 XmlConfiguration format that configures a ContextHandler 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
  • 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: