4.6.2. Host

The Host element represents a virtual host on the Engine. It allows you to associate a network name with the server, that is, to change the domains or the hostname of the Server.

Note

The network name needs to be registered in the Domain Name Service (DNS) server that manages your Internet domain (contact your Network Administrator for more information).
One Engine can contain multiple virtual hosts, that is the Engine element can have several Host elements nested. The Host element can contain Context elements for individual web applications associated with the virtual host. Exactly one of the Hosts in every Engine must have a name matching the defaultHost attribute of the Engine.
A Host element can contain multiple Alias elements to allow the virtual host to use multiple hostnames (refer to Section 4.6.2.1, “Defining Host Name Aliases”).
The Host element can contain at most one Realm element. A Realm element in a Host represents a database of users and their roles used by the virtual host. If the Realm element is nested in the Host element, the user information is shared across all Contexts nested inside the Host unless overridden by another Realm element defined for a child Context element.

Table 4.6. Host Element Attributes

Attribute Description
appBase
Application Base directory for the virtual host
The Application Base directory is the pathname of a directory that contains web applications to be deployed on the virtual host. The property value can be defined as an absolute path to the directory or a path relative to the $JBOSS_SERVER_HOME directory.
autoDeploy
automatic deployment of web applications dropped in the Application Base directory while the JBoss Web server is running (true by default)

Note

Note that the default deployment directory is $JBOSS_SERVER_HOME/server/$PROFILE/deploy/ directory.
backgroundProcessorDelay
delay between the invocation of the backgroundProcess method on the host and the invocation of the backgroundProcess method on the child containers of the Host (such as Contexts; set to -1 by default, that is the Host uses the background processing thread of its Engine)
If set to a positive value, the Host produces a thread. The thread waits for the specified amount of time and then invokes the backgroundProcess method on the virtual host and all its child containers.
Context containers can also define the backgroundProcessorDelay attribute. If the delay of a child Context is not negative, the Context uses its own processing thread.
className
class implementing the Host
The defined class must implement the org.apache.catalina.Host interface. If no class is specified, the standard implementation is used, that is, org.apache.catalina.core.StandardHost.
deployOnStartup
automatic deployment of web applications from the Host (true by default)
name
network name of the virtual host as registered in your Domain Name Service server
One of the Hosts nested in the Engine must have a name that matches the defaultHost setting for the parent Engine.

Table 4.7. Additional Element Attributes of the Standard Host Element Implementation (org.apache.catalina.core.StandardHost)

Attribute Description
deployXML
applying the context.xml file located inside the web application (that is, /META-INF/context.xml; true by default)
If set to false to parsing of the context.xml file is disabled. In security conscious environments, set to false to prevent applications from interacting with the container's configuration and provide an external context configuration file to the $JBOSS_SERVER_HOME/conf/enginename/hostname/ directory.
errorReportValveClass
class implementing the error reporting valve used by the Host
The defined class must implement the org.apache.catalina.Valve interface. If no class is specified, the org.apache.catalina.valves.ErrorReportValve implementation is used.
The valve defines the output error reports. This property allows you to customize the look of the error pages generated by JBoss Web.
unpackWARs
automatic unpacking of deployer WAR files (false by default)
If set to true, web applications that are placed in the appBase directory in the form of a web application archive (WAR) file are unpacked into a corresponding disk directory structure. If set to false, such a web application is run from the WAR file.
workDir
pathname to a scratch directory used by applications on the Host (if not specified, a suitable directory under $JBOSS_SERVER_HOME/work/ is used)
Each application has its own sub-directory with temporary read-write use. The directory can be made visible for servlets in the web application using the javax.servlet.context.tempdir servlet context attribute of type java.io.File as described in the Servlet Specification.
If a child Context defines the workDir property, the Host's workDir is overridden.

4.6.2.1. Defining Host Name Aliases

If more than one network name in the Domain Name Service server are resolved to the IP address of the same server, use the Host's Alias element to define such network name resolution.
<Host name="www.company.com" ...>
     ...
     <Alias>company.com</Alias>
     ...
 </Host>
Make sure the network names involved are registered in your DNS server and resolve to the same computer with the JBoss Web instance.