StandardHost (Apache Tomcat 7.0.96 API Documentation)

org.apache.catalina.core

## Class StandardHost

- java.lang.Object
- - org.apache.catalina.util.LifecycleBase
  - - org.apache.catalina.util.LifecycleMBeanBase
    - - org.apache.catalina.core.ContainerBase
      - - org.apache.catalina.core.StandardHost

- All Implemented Interfaces:
    javax.management.MBeanRegistration, Container, Host, Lifecycle

      public class StandardHost
      extends ContainerBase
      implements Host

  Standard implementation of the Host interface. Each child container must be a Context implementation to process the requests directed to a particular web application.
  Author:
    Craig R. McClanahan, Remy Maucherat

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.catalina.core.ContainerBase

      `ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild`

    - ### Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle

      `Lifecycle.SingleUse`

  - ### Field Summary

    - ### Fields inherited from class org.apache.catalina.core.ContainerBase

      `accessLog, backgroundProcessorDelay, children, cluster, listeners, loader, logger, logName, manager, name, parent, parentClassLoader, pipeline, resources, sm, startChildren, startStopExecutor, support`

    - ### Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase

      `mserver`

    - ### Fields inherited from interface org.apache.catalina.Host

      `ADD_ALIAS_EVENT, REMOVE_ALIAS_EVENT`

    - ### Fields inherited from interface org.apache.catalina.Container

      `ADD_CHILD_EVENT, ADD_MAPPER_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_MAPPER_EVENT, REMOVE_VALVE_EVENT`

    - ### Fields inherited from interface org.apache.catalina.Lifecycle

      `AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StandardHost()` Create a new StandardHost component with the default basic Valve.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAlias(java.lang.String alias)` Add an alias name that should be mapped to this same Host.
    `void` | `addChild(Container child)` Add a child Container, only if the proposed child is an implementation of Context.
    `java.lang.String[]` | `findAliases()` Return the set of alias names for this Host.
    `java.lang.String[]` | `findReloadedContextMemoryLeaks()` Attempt to identify the contexts that have a class loader memory leak.
    `java.lang.String[]` | `getAliases()`
    `java.lang.String` | `getAppBase()` Return the application root for this Host.
    `boolean` | `getAutoDeploy()` Return the value of the auto deploy flag.
    `java.lang.String` | `getConfigClass()` Return the Java class name of the context configuration class for new web applications.
    `java.lang.String` | `getContextClass()` Return the Java class name of the Context implementation class for new web applications.
    `boolean` | `getCreateDirs()` Returns true if the Host will attempt to create directories for appBase and xmlBase unless they already exist.
    `java.lang.String` | `getDeployIgnore()` Return the regular expression that defines the files and directories in the host's `appBase` that will be ignored by the automatic deployment process.
    `java.util.regex.Pattern` | `getDeployIgnorePattern()` Return the compiled regular expression that defines the files and directories in the host's `appBase` that will be ignored by the automatic deployment process.
    `boolean` | `getDeployOnStartup()` Return the value of the deploy on startup flag.
    `java.lang.String` | `getErrorReportValveClass()` Return the Java class name of the error report valve class for new web applications.
    `java.lang.String` | `getInfo()` Return descriptive information about this Container implementation and the corresponding version number, in the format `<description>/<version>`.
    `java.lang.String` | `getName()` Return the canonical, fully qualified, name of the virtual host this Container represents.
    `protected java.lang.String` | `getObjectNameKeyProperties()` Allow sub-classes to specify the key properties component of the `ObjectName` that will be used to register this component.
    `java.util.concurrent.ExecutorService` | `getStartStopExecutor()` Return the executor that is used for starting and stopping contexts.
    `boolean` | `getUndeployOldVersions()` Returns true of the Host is configured to automatically undeploy old versions of applications deployed using parallel deployment.
    `java.lang.String[]` | `getValveNames()` Return the MBean Names of the Valves associated with this Host
    `java.lang.String` | `getWorkDir()` Host work directory base.
    `java.lang.String` | `getXmlBase()` Return the XML root for this Host.
    `boolean` | `isCopyXML()` Return the copy XML config file flag for this component.
    `boolean` | `isDeployXML()` Deploy XML Context config files flag accessor.
    `boolean` | `isFailCtxIfServletStartFails()`
    `boolean` | `isUnpackWARs()` Unpack WARs flag accessor.
    `void` | `removeAlias(java.lang.String alias)` Remove the specified alias name from the aliases for this Host.
    `void` | `setAppBase(java.lang.String appBase)` Set the application root for this Host.
    `void` | `setAutoDeploy(boolean autoDeploy)` Set the auto deploy flag value for this host.
    `void` | `setConfigClass(java.lang.String configClass)` Set the Java class name of the context configuration class for new web applications.
    `void` | `setContextClass(java.lang.String contextClass)` Set the Java class name of the Context implementation class for new web applications.
    `void` | `setCopyXML(boolean copyXML)` Set the copy XML config file flag for this component.
    `void` | `setCreateDirs(boolean createDirs)` Set to true if the Host should attempt to create directories for xmlBase and appBase upon startup
    `void` | `setDeployIgnore(java.lang.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.
    `void` | `setDeployOnStartup(boolean deployOnStartup)` Set the deploy on startup flag value for this host.
    `void` | `setDeployXML(boolean deployXML)` Deploy XML Context config files flag mutator.
    `void` | `setErrorReportValveClass(java.lang.String errorReportValveClass)` Set the Java class name of the error report valve class for new web applications.
    `void` | `setFailCtxIfServletStartFails(boolean failCtxIfServletStartFails)`
    `void` | `setName(java.lang.String name)` Set the canonical, fully qualified, name of the virtual host this Container represents.
    `void` | `setUndeployOldVersions(boolean undeployOldVersions)` Set to true if the Host should automatically undeploy old versions of applications deployed using parallel deployment.
    `void` | `setUnpackWARs(boolean unpackWARs)` Unpack WARs flag mutator.
    `void` | `setWorkDir(java.lang.String workDir)` Host work directory base.
    `void` | `setXmlBase(java.lang.String xmlBase)` Set the Xml root for this Host.
    `protected void` | `startInternal()` Start this component and implement the requirements of `LifecycleBase.startInternal()`.
    `java.lang.String` | `toString()` Return a String representation of this component.

    - ### Methods inherited from class org.apache.catalina.core.ContainerBase

      `addContainerListener, addPropertyChangeListener, addValve, backgroundProcess, destroyInternal, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getChildren, getCluster, getClusterInternal, getDomainInternal, getLoader, getLoaderInternal, getLogger, getManager, getManagerInternal, getMappingObject, getParent, getParentClassLoader, getPipeline, getRealm, getRealmInternal, getResources, getResourcesInternal, getStartChildren, getStartStopThreads, initInternal, invoke, logAccess, logName, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setLoader, setManager, setParent, setParentClassLoader, setRealm, setResources, setStartChildren, setStartStopThreads, stopInternal, threadStart, threadStop`

    - ### Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase

      `getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister`

    - ### Methods inherited from class org.apache.catalina.util.LifecycleBase

      `addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.catalina.Container

      `addContainerListener, addPropertyChangeListener, backgroundProcess, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getCluster, getLoader, getLogger, getManager, getMappingObject, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, getStartStopThreads, invoke, logAccess, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setLoader, setManager, setParent, setParentClassLoader, setRealm, setResources, setStartStopThreads`

    - ### Methods inherited from interface org.apache.catalina.Lifecycle

      `addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop`

- - ### Constructor Detail

    - #### StandardHost

          public StandardHost()

      Create a new StandardHost component with the default basic Valve.

  - ### Method Detail

    - #### getUndeployOldVersions

          public boolean getUndeployOldVersions()

      Description copied from interface: `Host`
      Returns true of the Host is configured to automatically undeploy old versions of applications deployed using parallel deployment. This only takes effect is `Host.getAutoDeploy()` also returns true.
      Specified by:
        `getUndeployOldVersions` in interface `Host`

    - #### setUndeployOldVersions

          public void setUndeployOldVersions(boolean undeployOldVersions)

      Description copied from interface: `Host`
      Set to true if the Host should automatically undeploy old versions of applications deployed using parallel deployment. This only takes effect if `Host.getAutoDeploy()` returns true.
      Specified by:
        `setUndeployOldVersions` in interface `Host`

    - #### getStartStopExecutor

          public java.util.concurrent.ExecutorService getStartStopExecutor()

      Description copied from interface: `Host`
      Return 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.
      Specified by:
        `getStartStopExecutor` in interface `Host`

    - #### getAppBase

          public java.lang.String getAppBase()

      Return the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
      Specified by:
        `getAppBase` in interface `Host`

    - #### setAppBase

          public void setAppBase(java.lang.String appBase)

      Set the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
      Specified by:
        `setAppBase` in interface `Host`
      Parameters:
        `appBase` - The new application root

    - #### getXmlBase

          public java.lang.String getXmlBase()

      Return the XML root for this Host. This can be an absolute pathname, a relative pathname, or a URL. If null, defaults to ${catalina.base}/conf/<engine name>/<host name> directory
      Specified by:
        `getXmlBase` in interface `Host`

    - #### setXmlBase

          public void setXmlBase(java.lang.String xmlBase)

      Set the Xml root for this Host. This can be an absolute pathname, a relative pathname, or a URL. If null, defaults to ${catalina.base}/conf/<engine name>/<host name> directory
      Specified by:
        `setXmlBase` in interface `Host`
      Parameters:
        `xmlBase` - The new XML root

    - #### getCreateDirs

          public boolean getCreateDirs()

      Returns true if the Host will attempt to create directories for appBase and xmlBase unless they already exist.
      Specified by:
        `getCreateDirs` in interface `Host`
      Returns:
        true if the Host will attempt to create directories

    - #### setCreateDirs

          public void setCreateDirs(boolean createDirs)

      Set to true if the Host should attempt to create directories for xmlBase and appBase upon startup
      Specified by:
        `setCreateDirs` in interface `Host`
      Parameters:
        `createDirs` -

    - #### getAutoDeploy

          public boolean getAutoDeploy()

      Return the value of the auto deploy flag. If true, it indicates that this host's child webapps will be dynamically deployed.
      Specified by:
        `getAutoDeploy` in interface `Host`

    - #### setAutoDeploy

          public void setAutoDeploy(boolean autoDeploy)

      Set the auto deploy flag value for this host.
      Specified by:
        `setAutoDeploy` in interface `Host`
      Parameters:
        `autoDeploy` - The new auto deploy flag

    - #### getConfigClass

          public java.lang.String getConfigClass()

      Return the Java class name of the context configuration class for new web applications.
      Specified by:
        `getConfigClass` in interface `Host`

    - #### setConfigClass

          public void setConfigClass(java.lang.String configClass)

      Set the Java class name of the context configuration class for new web applications.
      Specified by:
        `setConfigClass` in interface `Host`
      Parameters:
        `configClass` - The new context configuration class

    - #### getContextClass

          public java.lang.String getContextClass()

      Return the Java class name of the Context implementation class for new web applications.

    - #### setContextClass

          public void setContextClass(java.lang.String contextClass)

      Set the Java class name of the Context implementation class for new web applications.
      Parameters:
        `contextClass` - The new context implementation class

    - #### getDeployOnStartup

          public boolean getDeployOnStartup()

      Return the value of the deploy on startup flag. If true, it indicates that this host's child webapps should be discovered and automatically deployed at startup time.
      Specified by:
        `getDeployOnStartup` in interface `Host`

    - #### setDeployOnStartup

          public void setDeployOnStartup(boolean deployOnStartup)

      Set the deploy on startup flag value for this host.
      Specified by:
        `setDeployOnStartup` in interface `Host`
      Parameters:
        `deployOnStartup` - The new deploy on startup flag

    - #### isDeployXML

          public boolean isDeployXML()

      Deploy XML Context config files flag accessor.

    - #### setDeployXML

          public void setDeployXML(boolean deployXML)

      Deploy XML Context config files flag mutator.

    - #### isCopyXML

          public boolean isCopyXML()

      Return the copy XML config file flag for this component.

    - #### setCopyXML

          public void setCopyXML(boolean copyXML)

      Set the copy XML config file flag for this component.
      Parameters:
        `copyXML` - The new copy XML flag

    - #### getErrorReportValveClass

          public java.lang.String getErrorReportValveClass()

      Return the Java class name of the error report valve class for new web applications.

    - #### setErrorReportValveClass

          public void setErrorReportValveClass(java.lang.String errorReportValveClass)

      Set the Java class name of the error report valve class for new web applications.
      Parameters:
        `errorReportValveClass` - The new error report valve class

    - #### getName

          public java.lang.String getName()

      Return the canonical, fully qualified, name of the virtual host this Container represents.
      Specified by:
        `getName` in interface `Container`
      Overrides:
        `getName` in class `ContainerBase`

    - #### setName

          public void setName(java.lang.String name)

      Set the canonical, fully qualified, name of the virtual host this Container represents.
      Specified by:
        `setName` in interface `Container`
      Overrides:
        `setName` in class `ContainerBase`
      Parameters:
        `name` - Virtual host name
      Throws:
        `java.lang.IllegalArgumentException` - if name is null

    - #### isUnpackWARs

          public boolean isUnpackWARs()

      Unpack WARs flag accessor.

    - #### setUnpackWARs

          public void setUnpackWARs(boolean unpackWARs)

      Unpack WARs flag mutator.

    - #### getWorkDir

          public java.lang.String getWorkDir()

      Host work directory base.

    - #### setWorkDir

          public void setWorkDir(java.lang.String workDir)

      Host work directory base.

    - #### getDeployIgnore

          public java.lang.String getDeployIgnore()

      Return the regular expression that defines the files and directories in the host's `appBase` that will be ignored by the automatic deployment process.
      Specified by:
        `getDeployIgnore` in interface `Host`

    - #### getDeployIgnorePattern

          public java.util.regex.Pattern getDeployIgnorePattern()

      Return the compiled regular expression that defines the files and directories in the host's `appBase` that will be ignored by the automatic deployment process.
      Specified by:
        `getDeployIgnorePattern` in interface `Host`

    - #### setDeployIgnore

          public void setDeployIgnore(java.lang.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.
      Specified by:
        `setDeployIgnore` in interface `Host`

    - #### isFailCtxIfServletStartFails

          public boolean isFailCtxIfServletStartFails()

    - #### setFailCtxIfServletStartFails

          public void setFailCtxIfServletStartFails(boolean failCtxIfServletStartFails)

    - #### addAlias

          public void addAlias(java.lang.String alias)

      Add an alias name that should be mapped to this same Host.
      Specified by:
        `addAlias` in interface `Host`
      Parameters:
        `alias` - The alias to be added

    - #### addChild

          public void addChild(Container child)

      Add a child Container, only if the proposed child is an implementation of Context.
      Specified by:
        `addChild` in interface `Container`
      Overrides:
        `addChild` in class `ContainerBase`
      Parameters:
        `child` - Child container to be added

    - #### findReloadedContextMemoryLeaks

          public java.lang.String[] findReloadedContextMemoryLeaks()

      Attempt to identify the contexts that have a class loader memory leak. This is usually triggered on context reload. Note: This method attempts to force a full garbage collection. This should be used with extreme caution on a production system.

    - #### findAliases

          public java.lang.String[] findAliases()

      Return the set of alias names for this Host. If none are defined, a zero length array is returned.
      Specified by:
        `findAliases` in interface `Host`

    - #### getInfo

          public java.lang.String getInfo()

      Return descriptive information about this Container implementation and the corresponding version number, in the format `<description>/<version>`.
      Specified by:
        `getInfo` in interface `Container`
      Overrides:
        `getInfo` in class `ContainerBase`

    - #### removeAlias

          public void removeAlias(java.lang.String alias)

      Remove the specified alias name from the aliases for this Host.
      Specified by:
        `removeAlias` in interface `Host`
      Parameters:
        `alias` - Alias name to be removed

    - #### toString

          public java.lang.String toString()

      Return a String representation of this component.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### startInternal

          protected void startInternal()
                                throws LifecycleException

      Start this component and implement the requirements of `LifecycleBase.startInternal()`.
      Overrides:
        `startInternal` in class `ContainerBase`
      Throws:
        `LifecycleException` - if this component detects a fatal error that prevents this component from being used

    - #### getValveNames

          public java.lang.String[] getValveNames()
                                           throws java.lang.Exception

      Return the MBean Names of the Valves associated with this Host
      Throws:
        `java.lang.Exception` - if an MBean cannot be created or registered

    - #### getAliases

          public java.lang.String[] getAliases()

    - #### getObjectNameKeyProperties

          protected java.lang.String getObjectNameKeyProperties()

      Description copied from class: `LifecycleMBeanBase`
      Allow sub-classes to specify the key properties component of the `ObjectName` that will be used to register this component.
      Specified by:
        `getObjectNameKeyProperties` in class `LifecycleMBeanBase`
      Returns:
        The string representation of the key properties component of the desired `ObjectName`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.