org.apache.catalina.core
Class StandardHost

java.lang.Object
  extended byorg.apache.catalina.core.ContainerBase
      extended byorg.apache.catalina.core.StandardHost
All Implemented Interfaces:
Container, Host, Lifecycle, javax.management.MBeanRegistration, Pipeline, java.io.Serializable

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 939525 2010-04-30 00:36:35Z kkolinko $
Author:
Craig R. McClanahan, Remy Maucherat
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.apache.catalina.core.ContainerBase
ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild
 
Field Summary
 
Fields inherited from class org.apache.catalina.core.ContainerBase
backgroundProcessorDelay, children, cluster, controller, domain, lifecycle, listeners, loader, logger, logName, manager, mserver, name, oname, parent, parentClassLoader, pipeline, realm, resources, sm, started, suffix, support, type
 
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_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
StandardHost()
          Create a new StandardHost component with the default basic Valve.
 
Method Summary
 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.
 javax.management.ObjectName createObjectName(java.lang.String domain, javax.management.ObjectName parent)
           
 void destroy()
           
 java.lang.String[] findAliases()
          Return the set of alias names for this Host.
 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 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 getHostConfigClass()
          Return the Java class name of the host configuration class (deployer)
 java.lang.String getInfo()
          Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.
 boolean getLiveDeploy()
          Return the value of the live deploy flag.
 java.lang.String getName()
          Return the canonical, fully qualified, name of the virtual host this Container represents.
 java.lang.String[] getValveNames()
          Return the MBean Names of the Valves assoicated with this Host
 java.lang.String getWorkDir()
          Host work directory base.
 boolean getXmlNamespaceAware()
          Get the server.xml <host> attribute's xmlNamespaceAware.
 boolean getXmlValidation()
          Get the server.xml <host> attribute's xmlValidation.
 void init()
          Init method, part of the MBean lifecycle.
 boolean isDeployXML()
          Deploy XML Context config files flag accessor.
 boolean isUnpackWARs()
          Unpack WARs flag accessor.
 Context map(java.lang.String uri)
          Return the Context that would be used to process the specified host-relative request URI, if any; otherwise return null.
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName oname)
           
 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 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 setHostConfigClass(java.lang.String hostConfigClass)
          Set the Java class name of the host config configuration class (deployer)
 void setLiveDeploy(boolean liveDeploy)
          Set the live deploy flag value for this host.
 void setName(java.lang.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(java.lang.String workDir)
          Host work directory base.
 void setXmlNamespaceAware(boolean xmlNamespaceAware)
          Set the namespace aware feature of the XML parser used when parsing xml instances.
 void setXmlValidation(boolean xmlValidation)
          Set the validation feature of the XML parser used when parsing xml instances.
 void start()
          Start this host.
 java.lang.String toString()
          Return a String representation of this component.
 
Methods inherited from class org.apache.catalina.core.ContainerBase
addContainerListener, addLifecycleListener, addPropertyChangeListener, addValve, backgroundProcess, findChild, findChildren, findContainerListeners, findLifecycleListeners, fireContainerEvent, getBackgroundProcessorDelay, getBasic, getChildren, getCluster, getContainerSuffix, getDomain, getFirst, getJmxName, getJSR77Suffix, getLoader, getLogger, getManager, getMappingObject, getObjectName, getParent, getParentClassLoader, getParentName, getPipeline, getRealm, getResources, getType, getValveObjectNames, getValves, invoke, logName, postDeregister, postRegister, preDeregister, removeChild, removeContainerListener, removeLifecycleListener, removePropertyChangeListener, removeValve, setBackgroundProcessorDelay, setBasic, setCluster, setDomain, setLoader, setManager, setParent, setParentClassLoader, setRealm, setResources, stop, threadStart, threadStop
 
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, getBackgroundProcessorDelay, getCluster, getLoader, getLogger, getManager, getMappingObject, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, invoke, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setLoader, setManager, setParent, setParentClassLoader, setRealm, setResources
 

Constructor Detail

StandardHost

public StandardHost()
Create a new StandardHost component with the default basic Valve.

Method Detail

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

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

getHostConfigClass

public java.lang.String getHostConfigClass()
Return the Java class name of the host configuration class (deployer)


setHostConfigClass

public void setHostConfigClass(java.lang.String hostConfigClass)
Set the Java class name of the host config configuration class (deployer)

Parameters:
hostConfigClass - The new host config configuration class (deployer)

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 discovred 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.


getLiveDeploy

public boolean getLiveDeploy()
Return the value of the live deploy flag. If true, it indicates that a background thread should be started that looks for web application context files, WAR files, or unpacked directories being dropped in to the appBase directory, and deploys new ones as they are encountered.


setLiveDeploy

public void setLiveDeploy(boolean liveDeploy)
Set the live deploy flag value for this host.

Parameters:
liveDeploy - The new live deploy 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 Host
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 Host
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.


setXmlValidation

public void setXmlValidation(boolean xmlValidation)
Set the validation feature of the XML parser used when parsing xml instances.

Specified by:
setXmlValidation in interface Host
Parameters:
xmlValidation - true to enable xml instance validation

getXmlValidation

public boolean getXmlValidation()
Get the server.xml <host> attribute's xmlValidation.

Specified by:
getXmlValidation in interface Host
Returns:
true if validation is enabled.

getXmlNamespaceAware

public boolean getXmlNamespaceAware()
Get the server.xml <host> attribute's xmlNamespaceAware.

Specified by:
getXmlNamespaceAware in interface Host
Returns:
true if namespace awarenes is enabled.

setXmlNamespaceAware

public void setXmlNamespaceAware(boolean xmlNamespaceAware)
Set the namespace aware feature of the XML parser used when parsing xml instances.

Specified by:
setXmlNamespaceAware in interface Host
Parameters:
xmlNamespaceAware - true to enable namespace awareness

getWorkDir

public java.lang.String getWorkDir()
Host work directory base.


setWorkDir

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


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

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

map

public Context map(java.lang.String uri)
Return the Context that would be used to process the specified host-relative request URI, if any; otherwise return null.

Specified by:
map in interface Host
Parameters:
uri - Request URI to be mapped

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.


start

public void start()
           throws LifecycleException
Start this host.

Specified by:
start in interface Lifecycle
Overrides:
start in class ContainerBase
Throws:
LifecycleException - if this component detects a fatal error that prevents it from being started

getValveNames

public java.lang.String[] getValveNames()
                                 throws java.lang.Exception
Return the MBean Names of the Valves assoicated with this Host

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

getAliases

public java.lang.String[] getAliases()

init

public void init()
Description copied from class: ContainerBase
Init method, part of the MBean lifecycle. If the container was added via JMX, it'll register itself with the parent, using the ObjectName conventions to locate the parent. If the container was added directly and it doesn't have an ObjectName, it'll create a name and register itself with the JMX console. On destroy(), the object will unregister.

Overrides:
init in class ContainerBase

destroy

public void destroy()
             throws java.lang.Exception
Overrides:
destroy in class ContainerBase
Throws:
java.lang.Exception

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName oname)
                                        throws java.lang.Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Overrides:
preRegister in class ContainerBase
Throws:
java.lang.Exception

createObjectName

public javax.management.ObjectName createObjectName(java.lang.String domain,
                                                    javax.management.ObjectName parent)
                                             throws java.lang.Exception
Overrides:
createObjectName in class ContainerBase
Throws:
java.lang.Exception


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