Package 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,- JmxEnabled,- 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.ContainerBaseContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild
 - 
Nested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
 
- 
 - 
Field Summary- 
Fields inherited from class org.apache.catalina.core.ContainerBaseaccessLog, backgroundProcessorDelay, children, cluster, listeners, logger, logName, name, parent, parentClassLoader, pipeline, sm, startChildren, startStopExecutor, support
 - 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBasemserver
 - 
Fields inherited from interface org.apache.catalina.ContainerADD_CHILD_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_VALVE_EVENT
 - 
Fields inherited from interface org.apache.catalina.HostADD_ALIAS_EVENT, REMOVE_ALIAS_EVENT
 - 
Fields inherited from interface org.apache.catalina.LifecycleAFTER_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 SummaryConstructors Constructor Description StandardHost()Create a new StandardHost component with the default basic Valve.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAlias(java.lang.String alias)Add an alias name that should be mapped to this same Host.voidaddChild(Container child)Add a child Container, only if the proposed child is an implementation of Context.java.lang.String[]findAliases()java.lang.String[]findReloadedContextMemoryLeaks()Attempt to identify the contexts that have a class loader memory leak.java.lang.String[]getAliases()java.lang.StringgetAppBase()java.io.FilegetAppBaseFile()booleangetAutoDeploy()java.io.FilegetConfigBaseFile()(java.lang.StringgetConfigClass()java.lang.StringgetContextClass()booleangetCreateDirs()Returnstrueif the Host will attempt to create directories for appBase and xmlBase unless they already exist.java.lang.StringgetDeployIgnore()java.util.regex.PatterngetDeployIgnorePattern()booleangetDeployOnStartup()java.lang.StringgetErrorReportValveClass()java.lang.StringgetName()Return a name string (suitable for use by humans) that describes this Container.protected java.lang.StringgetObjectNameKeyProperties()Allow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.java.util.concurrent.ExecutorServicegetStartStopExecutor()booleangetUndeployOldVersions()java.lang.String[]getValveNames()java.lang.StringgetWorkDir()java.lang.StringgetXmlBase()(booleanisCopyXML()booleanisDeployXML()booleanisFailCtxIfServletStartFails()booleanisUnpackWARs()voidremoveAlias(java.lang.String alias)Remove the specified alias name from the aliases for this Host.voidsetAppBase(java.lang.String appBase)Set the application root for this Host.voidsetAutoDeploy(boolean autoDeploy)Set the auto deploy flag value for this host.voidsetConfigClass(java.lang.String configClass)Set the Java class name of the context configuration class for new web applications.voidsetContextClass(java.lang.String contextClass)Set the Java class name of the Context implementation class for new web applications.voidsetCopyXML(boolean copyXML)Set the copy XML config file flag for this component.voidsetCreateDirs(boolean createDirs)Set totrueif the Host should attempt to create directories for xmlBase and appBase upon startupvoidsetDeployIgnore(java.lang.String deployIgnore)Set the regular expression that defines the files and directories in the host'sgetAppBase()that will be ignored by the automatic deployment process.voidsetDeployOnStartup(boolean deployOnStartup)Set the deploy on startup flag value for this host.voidsetDeployXML(boolean deployXML)Deploy XML Context config files flag mutator.voidsetErrorReportValveClass(java.lang.String errorReportValveClass)Set the Java class name of the error report valve class for new web applications.voidsetFailCtxIfServletStartFails(boolean failCtxIfServletStartFails)Change the behavior of Servlet startup errors on web application starts.voidsetName(java.lang.String name)Set the canonical, fully qualified, name of the virtual host this Container represents.voidsetUndeployOldVersions(boolean undeployOldVersions)Set totrueif the Host should automatically undeploy old versions of applications deployed using parallel deployment.voidsetUnpackWARs(boolean unpackWARs)Unpack WARs flag mutator.voidsetWorkDir(java.lang.String workDir)Set host work directory base.voidsetXmlBase(java.lang.String xmlBase)(Set the Xml root for this Host.protected voidstartInternal()Start this component and implement the requirements ofLifecycleBase.startInternal().- 
Methods inherited from class org.apache.catalina.core.ContainerBaseaddContainerListener, addPropertyChangeListener, addValve, backgroundProcess, destroyInternal, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getCatalinaBase, getCatalinaHome, getChildren, getCluster, getClusterInternal, getDomainInternal, getLogger, getLogName, getMBeanKeyProperties, getParent, getParentClassLoader, getPipeline, getRealm, getRealmInternal, getStartChildren, getStartStopThreads, initInternal, logAccess, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setParent, setParentClassLoader, setRealm, setStartChildren, setStartStopThreads, stopInternal, threadStart, threadStop, toString
 - 
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBasegetDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
 - 
Methods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.catalina.ContaineraddContainerListener, addPropertyChangeListener, backgroundProcess, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getCatalinaBase, getCatalinaHome, getCluster, getDomain, getLogger, getLogName, getMBeanKeyProperties, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getStartStopThreads, logAccess, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setParent, setParentClassLoader, setRealm, setStartStopThreads
 - 
Methods inherited from interface org.apache.catalina.LifecycleaddLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
 
- 
 
- 
- 
- 
Method Detail- 
getUndeployOldVersionspublic boolean getUndeployOldVersions() - Specified by:
- getUndeployOldVersionsin interface- Host
- Returns:
- trueof 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.
 
 - 
setUndeployOldVersionspublic void setUndeployOldVersions(boolean undeployOldVersions) Description copied from interface:HostSet totrueif the Host should automatically undeploy old versions of applications deployed using parallel deployment. This only takes effect ifHost.getAutoDeploy()returnstrue.- Specified by:
- setUndeployOldVersionsin interface- Host
- Parameters:
- undeployOldVersions- The new value for this flag
 
 - 
getStartStopExecutorpublic java.util.concurrent.ExecutorService getStartStopExecutor() - Specified by:
- getStartStopExecutorin interface- Host
- 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.
 
 - 
getAppBasepublic java.lang.String getAppBase() - Specified by:
- getAppBasein interface- Host
- Returns:
- the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
 
 - 
getAppBaseFilepublic java.io.File getAppBaseFile() - Specified by:
- getAppBaseFilein interface- Host
- Returns:
- an absolute Filefor the appBase of this Host. The file will be canonical if possible. There is no guarantee that that the appBase exists.
 
 - 
setAppBasepublic void setAppBase(java.lang.String appBase) Description copied from interface:HostSet the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.- Specified by:
- setAppBasein interface- Host
- Parameters:
- appBase- The new application root
 
 - 
getXmlBasepublic java.lang.String getXmlBase() (- Specified by:
- getXmlBasein interface- Host
- Returns:
- the XML root for this Host. This can be an absolute pathname, a relative pathname, or a URL. If null, the base path defaults to ${catalina.base}/conf/<engine name>/<host name> directory
 
 - 
setXmlBasepublic 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, the base path defaults to ${catalina.base}/conf/<engine name>/<host name> directory- Specified by:
- setXmlBasein interface- Host
- Parameters:
- xmlBase- The new XML root
 
 - 
getConfigBaseFilepublic java.io.File getConfigBaseFile() (- Specified by:
- getConfigBaseFilein interface- Host
- Returns:
- a default configuration path of this Host. The file will be canonical if possible.
 
 - 
getCreateDirspublic boolean getCreateDirs() Description copied from interface:HostReturnstrueif the Host will attempt to create directories for appBase and xmlBase unless they already exist.- Specified by:
- getCreateDirsin interface- Host
- Returns:
- trueif the Host will attempt to create directories for appBase and xmlBase unless they already exist.
 
 - 
setCreateDirspublic void setCreateDirs(boolean createDirs) Set totrueif the Host should attempt to create directories for xmlBase and appBase upon startup- Specified by:
- setCreateDirsin interface- Host
- Parameters:
- createDirs- the new flag value
 
 - 
getAutoDeploypublic boolean getAutoDeploy() - Specified by:
- getAutoDeployin interface- Host
- Returns:
- the value of the auto deploy flag. If true, it indicates that this host's child webapps will be dynamically deployed.
 
 - 
setAutoDeploypublic void setAutoDeploy(boolean autoDeploy) Set the auto deploy flag value for this host.- Specified by:
- setAutoDeployin interface- Host
- Parameters:
- autoDeploy- The new auto deploy flag
 
 - 
getConfigClasspublic java.lang.String getConfigClass() - Specified by:
- getConfigClassin interface- Host
- Returns:
- the Java class name of the context configuration class for new web applications.
 
 - 
setConfigClasspublic void setConfigClass(java.lang.String configClass) Set the Java class name of the context configuration class for new web applications.- Specified by:
- setConfigClassin interface- Host
- Parameters:
- configClass- The new context configuration class
 
 - 
getContextClasspublic java.lang.String getContextClass() - Returns:
- the Java class name of the Context implementation class for new web applications.
 
 - 
setContextClasspublic 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
 
 - 
getDeployOnStartuppublic boolean getDeployOnStartup() - Specified by:
- getDeployOnStartupin interface- Host
- 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 at startup time.
 
 - 
setDeployOnStartuppublic void setDeployOnStartup(boolean deployOnStartup) Set the deploy on startup flag value for this host.- Specified by:
- setDeployOnStartupin interface- Host
- Parameters:
- deployOnStartup- The new deploy on startup flag
 
 - 
isDeployXMLpublic boolean isDeployXML() - Returns:
- trueif XML context descriptors should be deployed.
 
 - 
setDeployXMLpublic void setDeployXML(boolean deployXML) Deploy XML Context config files flag mutator.- Parameters:
- deployXML-- trueif context descriptors should be deployed
 
 - 
isCopyXMLpublic boolean isCopyXML() - Returns:
- the copy XML config file flag for this component.
 
 - 
setCopyXMLpublic void setCopyXML(boolean copyXML) Set the copy XML config file flag for this component.- Parameters:
- copyXML- The new copy XML flag
 
 - 
getErrorReportValveClasspublic java.lang.String getErrorReportValveClass() - Returns:
- the Java class name of the error report valve class for new web applications.
 
 - 
setErrorReportValveClasspublic 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
 
 - 
getNamepublic java.lang.String getName() Description copied from class:ContainerBaseReturn a name string (suitable for use by humans) that describes this Container. Within the set of child containers belonging to a particular parent, Container names must be unique.- Specified by:
- getNamein interface- Container
- Overrides:
- getNamein class- ContainerBase
- Returns:
- the canonical, fully qualified, name of the virtual host this Container represents.
 
 - 
setNamepublic void setName(java.lang.String name) Set the canonical, fully qualified, name of the virtual host this Container represents.- Specified by:
- setNamein interface- Container
- Overrides:
- setNamein class- ContainerBase
- Parameters:
- name- Virtual host name
- Throws:
- java.lang.IllegalArgumentException- if name is null
 
 - 
isUnpackWARspublic boolean isUnpackWARs() - Returns:
- trueif WARs should be unpacked on deployment.
 
 - 
setUnpackWARspublic void setUnpackWARs(boolean unpackWARs) Unpack WARs flag mutator.- Parameters:
- unpackWARs-- trueto unpack WARs on deployment
 
 - 
getWorkDirpublic java.lang.String getWorkDir() - Returns:
- host work directory base.
 
 - 
setWorkDirpublic void setWorkDir(java.lang.String workDir) Set host work directory base.- Parameters:
- workDir- the new base work folder for this host
 
 - 
getDeployIgnorepublic java.lang.String getDeployIgnore() - Specified by:
- getDeployIgnorein interface- Host
- Returns:
- the regular expression that defines the files and directories in
 the host's getAppBase()that will be ignored by the automatic deployment process.
 
 - 
getDeployIgnorePatternpublic java.util.regex.Pattern getDeployIgnorePattern() - Specified by:
- getDeployIgnorePatternin interface- Host
- Returns:
- the compiled regular expression that defines the files and
 directories in the host's getAppBase()that will be ignored by the automatic deployment process.
 
 - 
setDeployIgnorepublic void setDeployIgnore(java.lang.String deployIgnore) Set the regular expression that defines the files and directories in the host'sgetAppBase()that will be ignored by the automatic deployment process.- Specified by:
- setDeployIgnorein interface- Host
- Parameters:
- deployIgnore- the regexp
 
 - 
isFailCtxIfServletStartFailspublic boolean isFailCtxIfServletStartFails() - Returns:
- trueif a webapp start should fail if a Servlet startup fails
 
 - 
setFailCtxIfServletStartFailspublic void setFailCtxIfServletStartFails(boolean failCtxIfServletStartFails) Change the behavior of Servlet startup errors on web application starts.- Parameters:
- failCtxIfServletStartFails-- falseto ignore errors on Servlets which are stated when the web application starts
 
 - 
addAliaspublic void addAlias(java.lang.String alias) Add an alias name that should be mapped to this same Host.
 - 
addChildpublic void addChild(Container child) Add a child Container, only if the proposed child is an implementation of Context.- Specified by:
- addChildin interface- Container
- Overrides:
- addChildin class- ContainerBase
- Parameters:
- child- Child container to be added
 
 - 
findReloadedContextMemoryLeakspublic 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.- Returns:
- a list of possibly leaking contexts
 
 - 
findAliasespublic java.lang.String[] findAliases() - Specified by:
- findAliasesin interface- Host
- Returns:
- the set of alias names for this Host. If none are defined, a zero length array is returned.
 
 - 
removeAliaspublic void removeAlias(java.lang.String alias) Remove the specified alias name from the aliases for this Host.- Specified by:
- removeAliasin interface- Host
- Parameters:
- alias- Alias name to be removed
 
 - 
startInternalprotected void startInternal() throws LifecycleExceptionStart this component and implement the requirements ofLifecycleBase.startInternal().- Overrides:
- startInternalin class- ContainerBase
- Throws:
- LifecycleException- if this component detects a fatal error that prevents this component from being used
 
 - 
getValveNamespublic java.lang.String[] getValveNames() throws java.lang.Exception- Returns:
- the MBean Names of the Valves associated with this Host
- Throws:
- java.lang.Exception- if an MBean cannot be created or registered
 
 - 
getAliasespublic java.lang.String[] getAliases() 
 - 
getObjectNameKeyPropertiesprotected java.lang.String getObjectNameKeyProperties() Description copied from class:LifecycleMBeanBaseAllow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.- Specified by:
- getObjectNameKeyPropertiesin class- LifecycleMBeanBase
- Returns:
- The string representation of the key properties component of the
          desired ObjectName
 
 
- 
 
-