Apache Tomcat 7.0.28

org.apache.catalina.core
Class StandardHost

java.lang.Object
  extended by org.apache.catalina.util.LifecycleBase
      extended by org.apache.catalina.util.LifecycleMBeanBase
          extended by org.apache.catalina.core.ContainerBase
              extended by org.apache.catalina.core.StandardHost
All Implemented Interfaces:
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.

Version:
$Id: StandardHost.java 1343337 2012-05-28 17:50:14Z kkolinko $
Author:
Craig R. McClanahan, Remy Maucherat

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.catalina.core.ContainerBase
ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild
 
Field Summary
 
Fields inherited from class org.apache.catalina.core.ContainerBase
accessLog, backgroundProcessorDelay, children, cluster, listeners, listenersLock, 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
StandardHost()
          Create a new StandardHost component with the default basic Valve.
 
Method Summary
 void addAlias(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.
 String[] findAliases()
          Return the set of alias names for this Host.
 String[] findReloadedContextMemoryLeaks()
          Attempt to identify the contexts that have a class loader memory leak.
 String[] getAliases()
           
 String getAppBase()
          Return the application root for this Host.
 boolean getAutoDeploy()
          Return the value of the auto deploy flag.
 String getConfigClass()
          Return the Java class name of the context configuration class for new web applications.
 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.
 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.
 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.
 String getErrorReportValveClass()
          Return the Java class name of the error report valve class for new web applications.
 String getInfo()
          Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.
 String getName()
          Return the canonical, fully qualified, name of the virtual host this Container represents.
protected  String getObjectNameKeyProperties()
          Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.
 ExecutorService getStartStopExecutor()
          Return the executor that is used for starting and stopping contexts.
 String[] getValveNames()
          Return the MBean Names of the Valves associated with this Host
 String getWorkDir()
          Host work directory base.
 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 isUnpackWARs()
          Unpack WARs flag accessor.
 void removeAlias(String alias)
          Remove the specified alias name from the aliases for this Host.
 void setAppBase(String appBase)
          Set the application root for this Host.
 void setAutoDeploy(boolean autoDeploy)
          Set the auto deploy flag value for this host.
 void setConfigClass(String configClass)
          Set the Java class name of the context configuration class for new web applications.
 void setContextClass(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(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(String errorReportValveClass)
          Set the Java class name of the error report valve class for new web applications.
 void setName(String name)
          Set the canonical, fully qualified, name of the virtual host this Container represents.
 void setUnpackWARs(boolean unpackWARs)
          Unpack WARs flag mutator.
 void setWorkDir(String workDir)
          Host work directory base.
 void setXmlBase(String xmlBase)
          Set the Xml root for this Host.
protected  void startInternal()
          Start this component and implement the requirements of LifecycleBase.startInternal().
 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, getDomainInternal, getLoader, getLogger, getManager, getMappingObject, getParent, getParentClassLoader, getPipeline, getRealm, getRealmInternal, getResources, 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

getStartStopExecutor

public 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 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(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 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(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 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(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 String getContextClass()
Return the Java class name of the Context implementation class for new web applications.


setContextClass

public void setContextClass(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 String getErrorReportValveClass()
Return the Java class name of the error report valve class for new web applications.


setErrorReportValveClass

public void setErrorReportValveClass(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 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(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:
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 String getWorkDir()
Host work directory base.


setWorkDir

public void setWorkDir(String workDir)
Host work directory base.


getDeployIgnore

public 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 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(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

addAlias

public void addAlias(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 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 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 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(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 String toString()
Return a String representation of this component.

Overrides:
toString in class 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 String[] getValveNames()
                       throws Exception
Return the MBean Names of the Valves associated with this Host

Throws:
Exception - if an MBean cannot be created or registered

getAliases

public String[] getAliases()

getObjectNameKeyProperties

protected 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

Apache Tomcat 7.0.28

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