Class WebAppProvider

All Implemented Interfaces:
AppProvider, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, 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 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
  • 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".

  • Constructor Details

    • WebAppProvider

      public WebAppProvider()
  • Method Details

    • isExtractWars

      @ManagedAttribute("extract war files") public boolean isExtractWars()
      Get the extractWars.
      the extractWars
    • setExtractWars

      public void setExtractWars(boolean extractWars)
      Set the extractWars.
      extractWars - the extractWars to set
    • isParentLoaderPriority

      @ManagedAttribute("parent classloader has priority") public boolean isParentLoaderPriority()
      Get the parentLoaderPriority.
      the parentLoaderPriority
    • setParentLoaderPriority

      public void setParentLoaderPriority(boolean parentLoaderPriority)
      Set the parentLoaderPriority.
      parentLoaderPriority - the parentLoaderPriority to set
    • getDefaultsDescriptor

      @ManagedAttribute("default descriptor for webapps") public String getDefaultsDescriptor()
      Get the defaultsDescriptor.
      the defaultsDescriptor
    • setDefaultsDescriptor

      public void setDefaultsDescriptor(String defaultsDescriptor)
      Set the defaultsDescriptor.
      defaultsDescriptor - the defaultsDescriptor to set
    • getConfigurationManager

      public ConfigurationManager getConfigurationManager()
    • setConfigurationManager

      public void setConfigurationManager(ConfigurationManager configurationManager)
      Set the configurationManager.
      configurationManager - the configurationManager to set
    • setConfigurationClasses

      public void setConfigurationClasses(String[] configurations)
      configurations - The configuration class names.
    • getConfigurationClasses

      @ManagedAttribute("configuration classes for webapps to be processed through") public String[] getConfigurationClasses()
    • setTempDir

      public void setTempDir(File directory)
      Set the Work directory where unpacked WAR files are managed from.

      Default is the same as the System Property.

      directory - the new work directory
    • getTempDir

      @ManagedAttribute("temp directory for use, null if no user set temp directory") public File getTempDir()
      Get the user supplied Work Directory.
      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 Exception
      Description copied from interface: AppProvider
      Create a ContextHandler for an App
      app - The App
      A ContextHandler
      IOException - if unable to create context
      Exception - if unable to create context
    • initializeContextPath

      protected void initializeContextPath(ContextHandler context, String contextName, boolean stripExtension)
    • fileChanged

      protected void fileChanged(String filename) throws Exception
      fileChanged in class ScanningAppProvider
    • fileAdded

      protected void fileAdded(String filename) throws Exception
      fileAdded in class ScanningAppProvider
    • fileRemoved

      protected void fileRemoved(String filename) throws Exception
      fileRemoved in class ScanningAppProvider