The Host Container
Table of Contents
Introduction
The Host element represents a virtual host, which is an association of a network name for a server (such as "www.mycompany.com") with the particular server on which Tomcat is running. For clients to be able to connect to a Tomcat server using its network name, this name must be registered in the Domain Name Service (DNS) server that manages the Internet domain you belong to - contact your Network Administrator for more information.
In many cases, System Administrators wish to associate more than
one network name (such as www.mycompany.com
and
company.com
) with the same virtual host and applications.
This can be accomplished using the Host
Name Aliases feature discussed below.
One or more Host elements are nested inside an
Engine element. Inside the Host element, you
can nest Context elements for the web
applications associated with this virtual host. Exactly one of the Hosts
associated with each Engine MUST have a name matching the
defaultHost
attribute of that Engine.
Clients normally use host names to identify the server they wish to connect to. This host name is also included in the HTTP request headers. Tomcat extracts the host name from the HTTP headers and looks for a Host with a matching name. If no match is found, the request is routed to the default host. The name of the default host does not have to match a DNS name (although it can) since any request where the DNS name does not match the name of a Host element will be routed to the default host.
The description below uses the variable name $CATALINA_BASE to refer the base directory against which most relative paths are resolved. If you have not configured Tomcat for multiple instances by setting a CATALINA_BASE directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME, the directory into which you have installed Tomcat.
Attributes
Common Attributes
All implementations of Host support the following attributes:
Attribute | Description |
---|---|
appBase |
The Application Base directory for this virtual host.
This is the pathname of a directory that may contain web applications
to be deployed on this virtual host. You may specify an
absolute pathname, or a pathname that is relative to the
|
xmlBase |
The XML Base directory for this virtual host.
This is the pathname of a directory that may contain context XML
descriptors to be deployed on this virtual host. You may specify an
absolute pathname for this directory, or a pathname that is relative
to the |
createDirs |
If set to |
autoDeploy |
This flag value indicates if Tomcat should check periodically for new
or updated web applications while Tomcat is running. If
|
backgroundProcessorDelay |
This value represents the delay in seconds between the invocation of the backgroundProcess method on this host and its child containers, including all contexts. Child containers will not be invoked if their delay value is not negative (which would mean they are using their own processing thread). Setting this to a positive value will cause a thread to be spawn. After waiting the specified amount of time, the thread will invoke the backgroundProcess method on this host and all its child containers. A host will use background processing to perform live web application deployment related tasks. If not specified, the default value for this attribute is -1, which means the host will rely on the background processing setting of its parent engine. |
className |
Java class name of the implementation to use. This class must
implement the |
deployIgnore |
A regular expression defining paths to ignore when
This regular expression is relative to See Automatic Application Deployment for more information. |
deployOnStartup |
This flag value indicates if web applications from this host should
be automatically deployed when Tomcat starts. The default is
|
failCtxIfServletStartFails |
Set to Each child context may override this attribute. If not specified, the default value of |
name |
Usually the network name of this virtual host, as registered in your
Domain Name Service server. Regardless of the case used to
specify the host name, Tomcat will convert it to lower case internally.
One of the Hosts nested within an Engine MUST
have a name that matches the |
startStopThreads |
The number of threads this Host will use to start
child Context elements in parallel. The same
thread pool will be used to deploy new
Contexts if automatic deployment is being
used. The special value of 0 will result in the value of
|
undeployOldVersions |
This flag determines if Tomcat, as part of the auto deployment
process, will check for old, unused versions of web applications
deployed using parallel deployment and, if any are found, remove them.
This flag only applies if |
Standard Implementation
The standard implementation of Host is org.apache.catalina.core.StandardHost. It supports the following additional attributes (in addition to the common attributes listed above):
Attribute | Description |
---|---|
copyXML |
Set to |
deployXML |
Set to |