org.apache.catalina.startup

Class ContextConfig

public class ContextConfig extends Object implements LifecycleListener

Startup event listener for a Context that configures the properties of that Context, and the associated defined servlets.

Version: $Id: ContextConfig.java 1558828 2014-01-16 15:12:59Z markt $

Author: Craig R. McClanahan Jean-Francois Arcand

Field Summary
protected static Propertiesauthenticators
The set of Authenticators that we know how to configure.
protected Contextcontext
The Context we are associated with.
protected static DigestercontextDigester
The Digester we will use to process web application context files.
protected MapcustomAuthenticators
Custom mappings of login methods to authenticators
protected StringdefaultContextXml
The default web application's context file location.
protected StringdefaultWebXml
The default web application's deployment descriptor location.
protected static longdeploymentCount
Deployment count.
protected static LoginConfigDUMMY_LOGIN_CONFIG
protected static Loglog
protected booleanok
Track any fatal errors during startup configuration processing.
protected StringoriginalDocBase
Original docBase.
protected static StringManagersm
The string resources for this package.
protected DigesterwebDigester
The Digester we will use to process web application deployment descriptor files.
protected WebRuleSetwebRuleSet
Method Summary
protected voidantiLocking()
protected voidapplicationAnnotationsConfig()
Process the application classes annotations, if it exists.
protected voidapplicationWebConfig()
Process the application configuration file, if it exists.
protected voidauthenticatorConfig()
Set up an Authenticator automatically if required, and one has not already been configured.
protected voidbeforeStart()
Process a "before start" event for this Context.
protected voidcontextConfig()
Process the default configuration file, if it exists.
protected DigestercreateContextDigester()
Create (if necessary) and return a Digester configured to process the context configuration descriptor for an application.
protected voidcreateWebXmlDigester(boolean namespaceAware, boolean validation)
Create and return a Digester configured to process the web application deployment descriptor (web.xml).
protected voiddefaultWebConfig()
Process the default configuration file, if it exists.
protected voiddestroy()
Process a "destroy" event for this Context.
protected voidfixDocBase()
Adjust docBase.
protected StringgetBaseDir()
protected FilegetConfigBase()
Get config base.
StringgetDefaultContextXml()
Return the location of the default context file
StringgetDefaultWebXml()
Return the location of the default deployment descriptor
protected StringgetHostConfigPath(String resourceName)
protected voidinit()
Process a "init" event for this Context.
voidlifecycleEvent(LifecycleEvent event)
Process events for an associated Context.
protected voidprocessContextConfig(File baseDir, String resourceName)
Process a context.xml.
protected voidprocessDefaultWebConfig(Digester digester, InputStream stream, InputSource source)
Process a default web.xml.
voidsetCustomAuthenticators(Map customAuthenticators)
Sets custom mappings of login methods to authenticators.
voidsetDefaultContextXml(String path)
Set the location of the default context file
voidsetDefaultWebXml(String path)
Set the location of the default deployment descriptor
protected voidstart()
Process a "start" event for this Context.
protected voidstop()
Process a "stop" event for this Context.
protected voidvalidateSecurityRoles()
Validate the usage of security role names in the web application deployment descriptor.

Field Detail

authenticators

protected static Properties authenticators
The set of Authenticators that we know how to configure. The key is the name of the implemented authentication method, and the value is the fully qualified Java class name of the corresponding Valve.

context

protected Context context
The Context we are associated with.

contextDigester

protected static Digester contextDigester
The Digester we will use to process web application context files.

customAuthenticators

protected Map customAuthenticators
Custom mappings of login methods to authenticators

defaultContextXml

protected String defaultContextXml
The default web application's context file location.

defaultWebXml

protected String defaultWebXml
The default web application's deployment descriptor location.

deploymentCount

protected static long deploymentCount
Deployment count.

DUMMY_LOGIN_CONFIG

protected static final LoginConfig DUMMY_LOGIN_CONFIG

log

protected static Log log

ok

protected boolean ok
Track any fatal errors during startup configuration processing.

originalDocBase

protected String originalDocBase
Original docBase.

sm

protected static final StringManager sm
The string resources for this package.

webDigester

protected Digester webDigester
The Digester we will use to process web application deployment descriptor files.

webRuleSet

protected WebRuleSet webRuleSet

Method Detail

antiLocking

protected void antiLocking()

applicationAnnotationsConfig

protected void applicationAnnotationsConfig()
Process the application classes annotations, if it exists.

applicationWebConfig

protected void applicationWebConfig()
Process the application configuration file, if it exists.

authenticatorConfig

protected void authenticatorConfig()
Set up an Authenticator automatically if required, and one has not already been configured.

beforeStart

protected void beforeStart()
Process a "before start" event for this Context.

contextConfig

protected void contextConfig()
Process the default configuration file, if it exists.

createContextDigester

protected Digester createContextDigester()
Create (if necessary) and return a Digester configured to process the context configuration descriptor for an application.

createWebXmlDigester

protected void createWebXmlDigester(boolean namespaceAware, boolean validation)
Create and return a Digester configured to process the web application deployment descriptor (web.xml).

defaultWebConfig

protected void defaultWebConfig()
Process the default configuration file, if it exists. The default config must be read with the container loader - so container servlets can be loaded

destroy

protected void destroy()
Process a "destroy" event for this Context.

fixDocBase

protected void fixDocBase()
Adjust docBase.

getBaseDir

protected String getBaseDir()

getConfigBase

protected File getConfigBase()
Get config base.

getDefaultContextXml

public String getDefaultContextXml()
Return the location of the default context file

getDefaultWebXml

public String getDefaultWebXml()
Return the location of the default deployment descriptor

getHostConfigPath

protected String getHostConfigPath(String resourceName)

init

protected void init()
Process a "init" event for this Context.

lifecycleEvent

public void lifecycleEvent(LifecycleEvent event)
Process events for an associated Context.

Parameters: event The lifecycle event that has occurred

processContextConfig

protected void processContextConfig(File baseDir, String resourceName)
Process a context.xml.

processDefaultWebConfig

protected void processDefaultWebConfig(Digester digester, InputStream stream, InputSource source)
Process a default web.xml.

setCustomAuthenticators

public void setCustomAuthenticators(Map customAuthenticators)
Sets custom mappings of login methods to authenticators.

Parameters: customAuthenticators Custom mappings of login methods to authenticators

setDefaultContextXml

public void setDefaultContextXml(String path)
Set the location of the default context file

Parameters: path Absolute/relative path to the default context.xml

setDefaultWebXml

public void setDefaultWebXml(String path)
Set the location of the default deployment descriptor

Parameters: path Absolute/relative path to the default web.xml

start

protected void start()
Process a "start" event for this Context.

stop

protected void stop()
Process a "stop" event for this Context.

validateSecurityRoles

protected void validateSecurityRoles()
Validate the usage of security role names in the web application deployment descriptor. If any problems are found, issue warning messages (for backwards compatibility) and add the missing roles. (To make these problems fatal instead, simply set the ok instance variable to false as well).
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.