Interface Host
- All Known Implementing Classes:
StandardHost
A Host is a Container that represents a virtual host in the Catalina servlet engine. It is useful in the
following types of scenarios:
- You wish to use Interceptors that see every single request processed by this particular virtual host.
- You wish to run Catalina in with a standalone HTTP connector, but still want support for multiple virtual hosts.
The parent Container attached to a Host is generally an Engine, but may be some other implementation, or may be omitted if it is not necessary.
The child containers attached to a Host are generally implementations of Context (representing an individual servlet context).
-
Nested Class Summary
Nested classes/interfaces inherited from interface Lifecycle
Lifecycle.SingleUse -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe ContainerEvent event type sent when a new alias is added byaddAlias().static final StringThe ContainerEvent event type sent when an old alias is removed byremoveAlias().Fields inherited from interface Container
ADD_CHILD_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_VALVE_EVENTFields inherited from interface 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an alias name that should be mapped to this same Host.String[]Get the array of alias names for this Host.Get the application root for this Host.Get an absoluteFilefor the appBase of this Host.booleanGet the value of the auto deploy flag.Get the default configuration path of this Host.Get the Java class name of the context configuration class for new web applications.booleanReturnstrueif the Host will attempt to create directories for appBase and xmlBase unless they already exist.Get the regular expression that defines the files and directories in the host's appBase that will be ignored by the automatic deployment process.Get the compiled regular expression that defines the files and directories in the host's appBase that will be ignored by the automatic deployment process.booleanGet the value of the deploy on startup flag.Get the legacy (Java EE) application root for this Host.Get an absoluteFilefor the legacy (Java EE) appBase of this Host.Get the executor that is used for starting and stopping contexts.booleanGet whether the Host is configured to automatically undeploy old versions of applications deployed using parallel deployment.Get the XML root for this Host.voidremoveAlias(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.voidsetCreateDirs(boolean createDirs) Should the Host attempt to create directories for xmlBase and appBase upon startup.voidsetDeployIgnore(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.voidsetDeployOnStartup(boolean deployOnStartup) Set the deploy on startup flag value for this host.voidsetLegacyAppBase(String legacyAppBase) Set the legacy (Java EE) application root for this Host.voidsetUndeployOldVersions(boolean undeployOldVersions) Set totrueif the Host should automatically undeploy old versions of applications deployed using parallel deployment.voidsetXmlBase(String xmlBase) Set the Xml root for this Host.Methods inherited from interface Container
addChild, addContainerListener, addPropertyChangeListener, backgroundProcess, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getCatalinaBase, getCatalinaHome, getCluster, getDomain, getLogger, getLogName, getMBeanKeyProperties, getName, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getStartStopThreads, logAccess, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setName, setParent, setParentClassLoader, setRealm, setStartStopThreadsMethods inherited from interface Lifecycle
addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
-
Field Details
-
ADD_ALIAS_EVENT
The ContainerEvent event type sent when a new alias is added byaddAlias().- See Also:
-
REMOVE_ALIAS_EVENT
The ContainerEvent event type sent when an old alias is removed byremoveAlias().- See Also:
-
-
Method Details
-
getXmlBase
String getXmlBase()Get 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.- Returns:
- the XML root
-
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- Parameters:
xmlBase- The new XML root
-
getConfigBaseFile
File getConfigBaseFile()Get the default configuration path of this Host. The file will be canonical if possible.- Returns:
- the configuration base file
-
getAppBase
String getAppBase()Get the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.- Returns:
- the application root
-
getAppBaseFile
-
setAppBase
Set the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.- Parameters:
appBase- The new application root
-
getLegacyAppBase
String getLegacyAppBase()Get the legacy (Java EE) application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.- Returns:
- the legacy application root
-
getLegacyAppBaseFile
-
setLegacyAppBase
Set the legacy (Java EE) application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.- Parameters:
legacyAppBase- The new legacy application root
-
getAutoDeploy
boolean getAutoDeploy()Get the value of the auto deploy flag. If true, it indicates that this host's child webapps should be discovered and automatically deployed dynamically.- Returns:
- the auto deploy flag
-
setAutoDeploy
void setAutoDeploy(boolean autoDeploy) Set the auto deploy flag value for this host.- Parameters:
autoDeploy- The new auto deploy flag
-
getConfigClass
String getConfigClass()Get the Java class name of the context configuration class for new web applications.- Returns:
- the context configuration class name
-
setConfigClass
Set the Java class name of the context configuration class for new web applications.- Parameters:
configClass- The new context configuration class
-
getDeployOnStartup
boolean getDeployOnStartup()Get the value of the deploy on startup flag. If true, it indicates that this host's child webapps should be discovered and automatically deployed.- Returns:
- the deploy on startup flag
-
setDeployOnStartup
void setDeployOnStartup(boolean deployOnStartup) Set the deploy on startup flag value for this host.- Parameters:
deployOnStartup- The new deploy on startup flag
-
getDeployIgnore
String getDeployIgnore()Get the regular expression that defines the files and directories in the host's appBase that will be ignored by the automatic deployment process.- Returns:
- the deploy ignore regular expression
-
getDeployIgnorePattern
Pattern getDeployIgnorePattern()Get the compiled regular expression that defines the files and directories in the host's appBase that will be ignored by the automatic deployment process.- Returns:
- the compiled deploy ignore pattern
-
setDeployIgnore
Set the regular expression that defines the files and directories in the host's appBase that will be ignored by the automatic deployment process.- Parameters:
deployIgnore- A regular expression matching file names
-
getStartStopExecutor
ExecutorService getStartStopExecutor()Get 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 multithreaded manner.- Returns:
- the start/stop executor
-
getCreateDirs
boolean getCreateDirs()Returnstrueif the Host will attempt to create directories for appBase and xmlBase unless they already exist.- Returns:
- true if the Host will attempt to create directories
-
setCreateDirs
void setCreateDirs(boolean createDirs) Should the Host attempt to create directories for xmlBase and appBase upon startup.- Parameters:
createDirs- The new value for this flag
-
getUndeployOldVersions
boolean getUndeployOldVersions()Get whether the Host is configured to automatically undeploy old versions of applications deployed using parallel deployment. This only takes effect ifgetAutoDeploy()also returnstrue.- Returns:
- the undeploy old versions flag
-
setUndeployOldVersions
void setUndeployOldVersions(boolean undeployOldVersions) Set totrueif the Host should automatically undeploy old versions of applications deployed using parallel deployment. This only takes effect ifgetAutoDeploy()returnstrue.- Parameters:
undeployOldVersions- The new value for this flag
-
addAlias
Add an alias name that should be mapped to this same Host.- Parameters:
alias- The alias to be added
-
findAliases
String[] findAliases()Get the array of alias names for this Host. If none are defined, a zero length array is returned.- Returns:
- the array of alias names
-
removeAlias
Remove the specified alias name from the aliases for this Host.- Parameters:
alias- Alias name to be removed
-