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: $Revision: 892815 $ $Date: 2009-12-21 14:27:57 +0100 (Mon, 21 Dec 2009) $

Author: Craig R. McClanahan Jean-Francois Arcand

Nested Class Summary
protected classContextConfig.ContextErrorHandler
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 SAXParseExceptionparseException
Any parse error which occurred while parsing XML descriptors.
protected static StringManagersm
The string resources for this package.
protected static DigesterwebDigester
The Digester we will use to process web application deployment descriptor files.
protected static WebRuleSetwebRuleSet
The Rule used to parse the web.xml
protected static booleanxmlNamespaceAware
Attribute value used to turn on/off XML namespace awarenes.
protected static booleanxmlValidation
Attribute value used to turn on/off XML validation
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 static DigestercreateWebDigester()
Create (if necessary) and return a Digester configured to process the web application deployment descriptor (web.xml).
static DigestercreateWebXmlDigester(boolean namespaceAware, boolean validation)
Create (if necessary) 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.

parseException

protected SAXParseException parseException
Any parse error which occurred while parsing XML descriptors.

sm

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

webDigester

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

webRuleSet

protected static WebRuleSet webRuleSet
The Rule used to parse the web.xml

xmlNamespaceAware

protected static boolean xmlNamespaceAware
Attribute value used to turn on/off XML namespace awarenes.

xmlValidation

protected static boolean xmlValidation
Attribute value used to turn on/off XML validation

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.

createWebDigester

protected static Digester createWebDigester()
Create (if necessary) and return a Digester configured to process the web application deployment descriptor (web.xml).

createWebXmlDigester

public static Digester createWebXmlDigester(boolean namespaceAware, boolean validation)
Create (if necessary) 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-2011 Apache Software Foundation. All Rights Reserved.