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:
MBeanRegistration,Container,Host,JmxEnabled,Lifecycle
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.ContainerBackgroundProcessorMonitor, ContainerBase.PrivilegedAddChildNested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse -
Field Summary
Fields inherited from class org.apache.catalina.core.ContainerBase
accessLog, backgroundProcessorDelay, backgroundProcessorFuture, children, cluster, listeners, logger, logName, monitorFuture, name, parent, parentClassLoader, pipeline, sm, startChildren, startStopExecutor, supportFields inherited from interface org.apache.catalina.Container
ADD_CHILD_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_VALVE_EVENTFields inherited from interface org.apache.catalina.Host
ADD_ALIAS_EVENT, REMOVE_ALIAS_EVENTFields 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
ConstructorsConstructorDescriptionCreate a new StandardHost component with the default basic Valve. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an alias name that should be mapped to this same Host.voidAdd a child Container, only if the proposed child is an implementation of Context.String[]String[]Attempt to identify the contexts that have a class loader memory leak.String[]boolean(booleanReturnstrueif the Host will attempt to create directories for appBase and xmlBase unless they already exist.booleangetName()Return a name string (suitable for use by humans) that describes this Container.protected StringAllow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.booleanString[](booleanbooleanbooleanbooleanvoidremoveAlias(String alias) Remove the specified alias name from the aliases for this Host.voidsetAppBase(String appBase) Set the application root for this Host.voidsetAutoDeploy(boolean autoDeploy) Set the auto deploy flag value for this host.voidsetConfigClass(String configClass) Set the Java class name of the context configuration class for new web applications.voidsetContextClass(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(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(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.voidsetLegacyAppBase(String legacyAppBase) Set the legacy (Java EE) application root for this Host.voidSet 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(String workDir) Set host work directory base.voidsetXmlBase(String xmlBase) (Set the Xml root for this Host.protected voidStart this component and implement the requirements ofLifecycleBase.startInternal().Methods inherited from class org.apache.catalina.core.ContainerBase
addContainerListener, 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, logAccess, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setParent, setParentClassLoader, setRealm, setStartChildren, setStartStopThreads, stopInternal, threadStart, threadStop, toStringMethods inherited from class org.apache.catalina.util.LifecycleMBeanBase
getDomain, getObjectName, initInternal, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregisterMethods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.catalina.Container
addContainerListener, 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, setStartStopThreadsMethods inherited from interface org.apache.catalina.Lifecycle
addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
-
Constructor Details
-
StandardHost
public StandardHost()Create a new StandardHost component with the default basic Valve.
-
-
Method Details
-
getUndeployOldVersions
public boolean getUndeployOldVersions()- Specified by:
getUndeployOldVersionsin interfaceHost- Returns:
trueof the Host is configured to automatically undeploy old versions of applications deployed using parallel deployment. This only takes effect isHost.getAutoDeploy()also returnstrue.
-
setUndeployOldVersions
public 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 interfaceHost- Parameters:
undeployOldVersions- The new value for this flag
-
getStartStopExecutor
- Specified by:
getStartStopExecutorin interfaceHost- 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.
-
getAppBase
- Specified by:
getAppBasein interfaceHost- Returns:
- the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
-
getAppBaseFile
- Specified by:
getAppBaseFilein interfaceHost- 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.
-
setAppBase
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 interfaceHost- Parameters:
appBase- The new application root
-
getLegacyAppBase
- Specified by:
getLegacyAppBasein interfaceHost- Returns:
- the legacy (Java EE) application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.
-
getLegacyAppBaseFile
- Specified by:
getLegacyAppBaseFilein interfaceHost- Returns:
- an absolute
Filefor 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
Description copied from interface:HostSet the legacy (Java EE) application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.- Specified by:
setLegacyAppBasein interfaceHost- Parameters:
legacyAppBase- The new legacy application root
-
getXmlBase
(- Specified by:
getXmlBasein interfaceHost- 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
(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- Specified by:
setXmlBasein interfaceHost- Parameters:
xmlBase- The new XML root
-
getConfigBaseFile
(- Specified by:
getConfigBaseFilein interfaceHost- Returns:
- a default configuration path of this Host. The file will be canonical if possible.
-
getCreateDirs
public 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 interfaceHost- Returns:
trueif the Host will attempt to create directories for appBase and xmlBase unless they already exist.
-
setCreateDirs
public void setCreateDirs(boolean createDirs) Set totrueif the Host should attempt to create directories for xmlBase and appBase upon startup- Specified by:
setCreateDirsin interfaceHost- Parameters:
createDirs- the new flag value
-
getAutoDeploy
public boolean getAutoDeploy()- Specified by:
getAutoDeployin interfaceHost- Returns:
- the value of the auto deploy flag. If true, it indicates that this host's child webapps will be dynamically deployed.
-
setAutoDeploy
public void setAutoDeploy(boolean autoDeploy) Set the auto deploy flag value for this host.- Specified by:
setAutoDeployin interfaceHost- Parameters:
autoDeploy- The new auto deploy flag
-
getConfigClass
- Specified by:
getConfigClassin interfaceHost- Returns:
- the Java class name of the context configuration class for new web applications.
-
setConfigClass
Set the Java class name of the context configuration class for new web applications.- Specified by:
setConfigClassin interfaceHost- Parameters:
configClass- The new context configuration class
-
getContextClass
- Returns:
- the Java class name of the Context implementation class for new web applications.
-
setContextClass
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()- Specified by:
getDeployOnStartupin interfaceHost- 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.
-
setDeployOnStartup
public void setDeployOnStartup(boolean deployOnStartup) Set the deploy on startup flag value for this host.- Specified by:
setDeployOnStartupin interfaceHost- Parameters:
deployOnStartup- The new deploy on startup flag
-
isDeployXML
public boolean isDeployXML()- Returns:
trueif XML context descriptors should be deployed.
-
setDeployXML
public void setDeployXML(boolean deployXML) Deploy XML Context config files flag mutator.- Parameters:
deployXML-trueif context descriptors should be deployed
-
isCopyXML
public boolean isCopyXML()- Returns:
- 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
- Returns:
- the Java class name of the error report valve class for new web applications.
-
setErrorReportValveClass
Set the Java class name of the error report valve class for new web applications.- Parameters:
errorReportValveClass- The new error report valve class
-
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 interfaceContainer- Overrides:
getNamein classContainerBase- Returns:
- the canonical, fully qualified, name of the virtual host this Container represents.
-
setName
Set the canonical, fully qualified, name of the virtual host this Container represents.- Specified by:
setNamein interfaceContainer- Overrides:
setNamein classContainerBase- Parameters:
name- Virtual host name- Throws:
IllegalArgumentException- if name is null
-
isUnpackWARs
public boolean isUnpackWARs()- Returns:
trueif WARs should be unpacked on deployment.
-
setUnpackWARs
public void setUnpackWARs(boolean unpackWARs) Unpack WARs flag mutator.- Parameters:
unpackWARs-trueto unpack WARs on deployment
-
getWorkDir
- Returns:
- host work directory base.
-
setWorkDir
Set host work directory base.- Parameters:
workDir- the new base work folder for this host
-
getDeployIgnore
- Specified by:
getDeployIgnorein interfaceHost- Returns:
- the regular expression that defines the files and directories in the host's
getAppBase()that will be ignored by the automatic deployment process.
-
getDeployIgnorePattern
- Specified by:
getDeployIgnorePatternin interfaceHost- 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.
-
setDeployIgnore
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 interfaceHost- Parameters:
deployIgnore- the regexp
-
isFailCtxIfServletStartFails
public boolean isFailCtxIfServletStartFails()- Returns:
trueif a webapp start should fail if a Servlet startup fails
-
setFailCtxIfServletStartFails
public 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
-
addAlias
Add an alias name that should be mapped to this same Host. -
addChild
Add a child Container, only if the proposed child is an implementation of Context.- Specified by:
addChildin interfaceContainer- Overrides:
addChildin classContainerBase- Parameters:
child- Child container to be added
-
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
-
findAliases
- Specified by:
findAliasesin interfaceHost- Returns:
- the set of alias names for this Host. If none are defined, a zero length array is returned.
-
removeAlias
Remove the specified alias name from the aliases for this Host.- Specified by:
removeAliasin interfaceHost- Parameters:
alias- Alias name to be removed
-
startInternal
Start this component and implement the requirements ofLifecycleBase.startInternal().- Overrides:
startInternalin classContainerBase- Throws:
LifecycleException- if this component detects a fatal error that prevents this component from being used
-
getValveNames
- Returns:
- the MBean Names of the Valves associated with this Host
- Throws:
Exception- if an MBean cannot be created or registered
-
getAliases
-
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 classLifecycleMBeanBase- Returns:
- The string representation of the key properties component of the
desired
ObjectName
-