Interface Host

All Superinterfaces:
Container, Lifecycle
All Known Implementing Classes:
StandardHost

public interface Host extends Container
A Host is a Container that represents a virtual host in the Catalina servlet engine. It is useful in the following types of scenarios:
  • You wish to use Interceptors that see every single request processed by this particular virtual host.
  • You wish to run Catalina in with a standalone HTTP connector, but still want support for multiple virtual hosts.
In general, you would not use a Host when deploying Catalina connected to a web server (such as Apache), because the Connector will have utilized the web server's facilities to determine which Context (or perhaps even which Wrapper) should be utilized to process this request.

The parent Container attached to a Host is generally an Engine, but may be some other implementation, or may be omitted if it is not necessary.

The child containers attached to a Host are generally implementations of Context (representing an individual servlet context).

Author:
Craig R. McClanahan
  • Field Details

    • ADD_ALIAS_EVENT

      static final String ADD_ALIAS_EVENT
      The ContainerEvent event type sent when a new alias is added by addAlias().
      See Also:
    • REMOVE_ALIAS_EVENT

      static final String REMOVE_ALIAS_EVENT
      The ContainerEvent event type sent when an old alias is removed by removeAlias().
      See Also:
  • Method Details

    • getXmlBase

      String getXmlBase()
      Returns:
      the XML root for this Host. This can be an absolute pathname or a relative pathname. If null, the base path defaults to ${catalina.base}/conf/<engine name>/<host name> directory
    • setXmlBase

      void setXmlBase(String xmlBase)
      Set the Xml root for this Host. This can be an absolute pathname or a relative pathname. If null, the base path defaults to ${catalina.base}/conf/<engine name>/<host name> directory
      Parameters:
      xmlBase - The new XML root
    • getConfigBaseFile

      File getConfigBaseFile()
      Returns:
      a default configuration path of this Host. The file will be canonical if possible.
    • getAppBase

      String getAppBase()
      Returns:
      the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
    • getAppBaseFile

      File getAppBaseFile()
      Returns:
      an absolute File for the appBase of this Host. The file will be canonical if possible. There is no guarantee that that the appBase exists.
    • setAppBase

      void setAppBase(String appBase)
      Set the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
      Parameters:
      appBase - The new application root
    • getLegacyAppBase

      String getLegacyAppBase()
      Returns:
      the legacy (Java EE) application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
    • getLegacyAppBaseFile

      File getLegacyAppBaseFile()
      Returns:
      an absolute File for the legacy (Java EE) appBase of this Host. The file will be canonical if possible. There is no guarantee that that the appBase exists.
    • setLegacyAppBase

      void setLegacyAppBase(String legacyAppBase)
      Set the legacy (Java EE) application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
      Parameters:
      legacyAppBase - The new legacy application root
    • getAutoDeploy

      boolean getAutoDeploy()
      Returns:
      the value of the auto deploy flag. If true, it indicates that this host's child webapps should be discovered and automatically deployed dynamically.
    • setAutoDeploy

      void setAutoDeploy(boolean autoDeploy)
      Set the auto deploy flag value for this host.
      Parameters:
      autoDeploy - The new auto deploy flag
    • getConfigClass

      String getConfigClass()
      Returns:
      the Java class name of the context configuration class for new web applications.
    • setConfigClass

      void setConfigClass(String configClass)
      Set the Java class name of the context configuration class for new web applications.
      Parameters:
      configClass - The new context configuration class
    • getDeployOnStartup

      boolean getDeployOnStartup()
      Returns:
      the value of the deploy on startup flag. If true, it indicates that this host's child webapps should be discovered and automatically deployed.
    • setDeployOnStartup

      void setDeployOnStartup(boolean deployOnStartup)
      Set the deploy on startup flag value for this host.
      Parameters:
      deployOnStartup - The new deploy on startup flag
    • getDeployIgnore

      String getDeployIgnore()
      Returns:
      the regular expression that defines the files and directories in the host's appBase that will be ignored by the automatic deployment process.
    • getDeployIgnorePattern

      Pattern getDeployIgnorePattern()
      Returns:
      the compiled regular expression that defines the files and directories in the host's appBase that will be ignored by the automatic deployment process.
    • setDeployIgnore

      void setDeployIgnore(String deployIgnore)
      Set the regular expression that defines the files and directories in the host's appBase that will be ignored by the automatic deployment process.
      Parameters:
      deployIgnore - A regular expression matching file names
    • getStartStopExecutor

      ExecutorService getStartStopExecutor()
      Returns:
      the executor that is used for starting and stopping contexts. This is primarily for use by components deploying contexts that want to do this in a multi-threaded manner.
    • getCreateDirs

      boolean getCreateDirs()
      Returns true if the Host will attempt to create directories for appBase and xmlBase unless they already exist.
      Returns:
      true if the Host will attempt to create directories
    • setCreateDirs

      void setCreateDirs(boolean createDirs)
      Should the Host attempt to create directories for xmlBase and appBase upon startup.
      Parameters:
      createDirs - The new value for this flag
    • getUndeployOldVersions

      boolean getUndeployOldVersions()
      Returns:
      true of the Host is configured to automatically undeploy old versions of applications deployed using parallel deployment. This only takes effect is getAutoDeploy() also returns true.
    • setUndeployOldVersions

      void setUndeployOldVersions(boolean undeployOldVersions)
      Set to true if the Host should automatically undeploy old versions of applications deployed using parallel deployment. This only takes effect if getAutoDeploy() returns true.
      Parameters:
      undeployOldVersions - The new value for this flag
    • addAlias

      void addAlias(String alias)
      Add an alias name that should be mapped to this same Host.
      Parameters:
      alias - The alias to be added
    • findAliases

      String[] findAliases()
      Returns:
      the set of alias names for this Host. If none are defined, a zero length array is returned.
    • removeAlias

      void removeAlias(String alias)
      Remove the specified alias name from the aliases for this Host.
      Parameters:
      alias - Alias name to be removed