Top Description Inners Fields Constructors Methods
org.apache.catalina.startup

public Class HostConfig

extends Object
implements LifecycleListener
Class Inheritance
All Implemented Interfaces
org.apache.catalina.LifecycleListener
Imports
java.io.File, .FileInputStream, .FileOutputStream, .IOException, .InputStream, .OutputStream, java.net.MalformedURLException, .URL, java.nio.file.Files, java.security.CodeSource, .Permission, .PermissionCollection, .Policy, java.security.cert.Certificate, java.util.ArrayList, .HashMap, .HashSet, .Iterator, .LinkedHashMap, .List, .Locale, .Map, .Set, .SortedSet, .TreeSet, java.util.concurrent.ConcurrentHashMap, .ExecutorService, .Future, java.util.jar.JarEntry, .JarFile, java.util.regex.Matcher, .Pattern, javax.management.ObjectName, org.apache.catalina.Container, .Context, .DistributedManager, .Globals, .Host, .Lifecycle, .LifecycleEvent, .LifecycleListener, .Manager, org.apache.catalina.core.StandardContext, .StandardHost, org.apache.catalina.security.DeployXmlPermission, org.apache.catalina.util.ContextName, .IOTools, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.jakartaee.Migration, org.apache.tomcat.util.ExceptionUtils, org.apache.tomcat.util.buf.UriUtil, org.apache.tomcat.util.digester.Digester, org.apache.tomcat.util.modeler.Registry, org.apache.tomcat.util.res.StringManager

Startup event listener for a Host that configures the properties of that Host, and the associated defined contexts.
Authors
Craig R. McClanahan, Remy Maucherat

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
protected static class
HostConfig.DeployedApplication

This class represents the state of a deployed application, as well as the monitored resources.

private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
protected String
contextClass

The Java class name of the Context implementation we should use.

protected boolean
copyXML

Should XML files be copied to $CATALINA_BASE/conf/<engine>/<host> by default when a web application is deployed?

protected final Map<String, HostConfig.DeployedApplication>
deployed

Map of deployed applications.

protected boolean
deployXML

Should we deploy XML Context config files packaged with WAR files and directories?

protected Digester
digester

The Digester instance used to parse context descriptors.

private final Object
protected static final long
FILE_MODIFICATION_RESOLUTION_MS

The resolution, in milliseconds, of file modification times.

protected Host
host

The Host we are associated with.

protected final Set<String>
invalidWars

The list of Wars in the appBase to be ignored because they are invalid (e.g. contain /../ sequences).

private static final Log
protected ObjectName
oname

The JMX ObjectName of this component.

private Set<String>
servicedSet

Set of applications which are being serviced, and shouldn't be deployed/undeployed/redeployed at the moment.

protected static final StringManager
sm

The string resources for this package.

protected boolean
unpackWARs

Should we unpack WAR files when auto-deploying applications in the appBase directory?

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
addWatchedResources(HostConfig.DeployedApplication
HostConfig deployed app
app
,
String
web app docBase
docBase
,
Context
web application context
context
)

Add watched resources to the specified Context.

public void
protected void
check()

Check status of all webapps.

public void
check(String
The name of the web application to check
name
)

Check status of a specific web application and reload, redeploy or deploy it as necessary.

protected void
checkResources(HostConfig.DeployedApplication
The web application to check
app
,
boolean
When checking files for modification should the check that requires that any file modification must have occurred at least as long ago as the resolution of the file time stamp be skipped
skipFileModificationResolutionCheck
)

Check resources for redeployment and reloading.

public void
checkUndeploy()

Check for old versions of applications using parallel deployment that are now unused (have no active sessions) and undeploy any that are found.

protected static Digester

Returns:

the digester
createDigester
(String
The class which will be used to create the context instance
contextClassName
)

Create the digester which will be used to parse context config files.

private void
deleteRedeployResources(HostConfig.DeployedApplication app, String[] resources, int i, boolean deleteReloadResources)

protected void
deployApps()

Deploy applications for any directories or WAR files that are found in our "application root" directory.

protected void
deployApps(String
The context name which should be deployed
name
)

Deploy applications for any directories or WAR files that are found in our "application root" directory.

protected void
deployDescriptor(ContextName
The context name
cn
,
File
The descriptor
contextXml
)

Deploy specified context descriptor.

protected void
deployDescriptors(File
The config base
configBase
,
String[]
The XML descriptors which should be deployed
files
)

Deploy XML context descriptors.

protected void
deployDirectories(File
The base path for applications
appBase
,
String[]
The exploded webapps that should be deployed
files
)

Deploy exploded webapps.

protected void
deployDirectory(ContextName
The context name
cn
,
File
The path to the root folder of the webapp
dir
)

Deploy exploded webapp.

protected boolean

Returns:

true if the specified deployment exists
deploymentExists
(String
of the context which will be checked
contextName
)

Check if a webapp is already deployed in this host.

protected void
deployWAR(ContextName
The context name
cn
,
File
The WAR file
war
)

Deploy packed WAR.

protected void
deployWARs(File
The base path for applications
appBase
,
String[]
The WARs to deploy
files
)

Deploy WAR files.

protected String[]

Returns:

The filtered list of application paths
filterAppPaths
(String[]
The list of application paths to filter
unfilteredAppPaths
)

Filter the list of application file paths to remove those that match the regular expression defined by Host#getDeployIgnore().

public String

Returns:

the config base
getConfigBaseName
()

Get the name of the configBase.

public String

Returns:

the Context implementation class name.
getContextClass
()

public long

Returns:

0L if no application with that name is deployed, or the instant on which the application was deployed
getDeploymentTime
(String
the context name
name
)

Get the instant where an application was deployed.

public boolean

Returns:

the copy XML config file flag for this component.
isCopyXML
()

private boolean
public boolean

Returns:

true if the application has been deployed and false if the application has not been deployed or does not exist
isDeployed
(String
the context name
name
)

Has the specified application been deployed?

private boolean
public boolean

Returns:

the deploy XML config file flag for this component.
isDeployXML
()

public boolean

Returns:

the unpack WARs flag.
isUnpackWARs
()

public void
lifecycleEvent(LifecycleEvent
The lifecycle event that has occurred
event
)

Implements org.apache.catalina.LifecycleListener.lifecycleEvent.

Process the START event for an associated Host.

public void
manageApp(Context
The context instance
context
)

Add a new Context to be managed by us.

protected void
migrateLegacyApp(File source, File destination)

protected void
private void
reload(HostConfig.DeployedApplication app, File fileToRemove, String newDocBase)

public void
removeServiced(String
the context name
name
)

Removed a serviced application from the list.

protected File
public void
setContextClass(String
The new Context implementation class name.
contextClass
)

Set the Context implementation class name.

public void
setCopyXML(boolean
The new copy XML flag
copyXML
)

Set the copy XML config file flag for this component.

public void
setDeployXML(boolean
The new deploy XML flag
deployXML
)

Set the deploy XML config file flag for this component.

public void
setUnpackWARs(boolean
The new unpack WARs flag
unpackWARs
)

Set the unpack WARs flag.

public void
start()

Process a "start" event for this Host.

public void
stop()

Process a "stop" event for this Host.

public boolean

Returns:

true if the application was not already in the list
tryAddServiced
(String
the context name
name
)

Add a serviced application to the list and indicates if the application was already present in the list.

private void
public void
unmanageApp(String
The context name
contextName
)

Remove a webapp from our control.

private boolean
validateContextPath(File appBase, String contextPath)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait