Package org.apache.catalina.startup
Class ContextConfig
- java.lang.Object
-
- org.apache.catalina.startup.ContextConfig
-
- All Implemented Interfaces:
LifecycleListener
- Direct Known Subclasses:
WebModuleContextConfig
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: 1.14 $ $Date: 2007/02/20 20:16:56 $
- Author:
- Craig R. McClanahan, Jean-Francois Arcand
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classContextConfig.ContextErrorHandler
-
Field Summary
Fields Modifier and Type Field Description protected static PropertiesauthenticatorsThe set of Authenticators that we know how to configure.protected ContextcontextThe Context we are associated with.protected static DigestercontextDigesterTheDigesterwe will use to process web application context files.protected Map<String,Authenticator>customAuthenticatorsprotected StringdefaultContextXmlThe default web application's context file location.protected StringdefaultWebXmlThe default web application's deployment descriptor location.protected booleanokTrack any fatal errors during startup configuration processing.protected SAXParseExceptionparseExceptionAny parse error which occurred while parsing XML descriptors.protected static DigesterwebDigesterTheDigesterwe will use to process web application deployment descriptor files.protected static WebRuleSetwebRuleSetTheRuleused to parse the web.xml
-
Constructor Summary
Constructors Constructor Description ContextConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplicationConfig()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 voidcontextConfig()Process the default configuration file, if it exists.protected static DigestercreateContextDigester()Create and return a Digester configured to process the context configuration descriptor for an application.static DigestercreateWebDigester()Create and return a Digester configured to process the web application deployment descriptor (web.xml).static DigestercreateWebXmlDigester(boolean namespaceAware, boolean validation)protected voiddefaultConfig()Process the default configuration file, if it exists.protected voidfixDocBase()Adjust docBase.protected StringgetBaseDir()intgetDebug()Return the debugging detail level for this component.StringgetDefaultContextXml()Return the location of the default context fileStringgetDefaultWebXml()Return the location of the default deployment descriptorprotected voidinit()Process a "init" event for this Context.voidlifecycleEvent(LifecycleEvent event)Process the START event for an associated Context.protected voidmanagerConfig()Set up a manager.protected voidprocessContextConfig(File baseDir, String resourceName)Process a context.xml.voidsetClassLoader(ClassLoader cl)voidsetCustomAuthenticators(Map<String,Authenticator> customAuthenticators)Sets custom mappings of login methods to authenticators.voidsetDebug(int debug)Set the debugging detail level for this component.voidsetDefaultContextXml(String path)Set the location of the default context filevoidsetDefaultWebXml(String path)Set the location of the default deployment descriptorprotected voidstart()Process a "start" event for this Context - in backgroundprotected 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
-
customAuthenticators
protected Map<String,Authenticator> customAuthenticators
-
authenticators
protected static final 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.
-
defaultContextXml
protected String defaultContextXml
The default web application's context file location.
-
defaultWebXml
protected String defaultWebXml
The default web application's deployment descriptor location.
-
ok
protected boolean ok
Track any fatal errors during startup configuration processing.
-
parseException
protected SAXParseException parseException
Any parse error which occurred while parsing XML descriptors.
-
contextDigester
protected static final Digester contextDigester
TheDigesterwe will use to process web application context files.
-
webDigester
protected static final Digester webDigester
TheDigesterwe will use to process web application deployment descriptor files.
-
webRuleSet
protected static final WebRuleSet webRuleSet
TheRuleused to parse the web.xml
-
-
Method Detail
-
setClassLoader
public void setClassLoader(ClassLoader cl)
-
getDebug
public int getDebug()
Return the debugging detail level for this component.
-
setDebug
public void setDebug(int debug)
Set the debugging detail level for this component.- Parameters:
debug- The new debugging detail level
-
getDefaultWebXml
public String getDefaultWebXml()
Return the location of the default deployment descriptor
-
setDefaultWebXml
public void setDefaultWebXml(String path)
Set the location of the default deployment descriptor- Parameters:
path- Absolute/relative path to the default web.xml
-
getDefaultContextXml
public String getDefaultContextXml()
Return the location of the default context file
-
setDefaultContextXml
public void setDefaultContextXml(String path)
Set the location of the default context file- Parameters:
path- Absolute/relative path to the default context.xml
-
setCustomAuthenticators
public void setCustomAuthenticators(Map<String,Authenticator> customAuthenticators)
Sets custom mappings of login methods to authenticators.- Parameters:
customAuthenticators- Custom mappings of login methods to authenticators
-
lifecycleEvent
public void lifecycleEvent(LifecycleEvent event) throws LifecycleException
Process the START event for an associated Context.- Specified by:
lifecycleEventin interfaceLifecycleListener- Parameters:
event- The lifecycle event that has occurred- Throws:
LifecycleException
-
applicationConfig
protected void applicationConfig() throws LifecycleExceptionProcess the application configuration file, if it exists.- Throws:
LifecycleException
-
managerConfig
protected void managerConfig()
Set up a manager.
-
authenticatorConfig
protected void authenticatorConfig() throws LifecycleExceptionSet up an Authenticator automatically if required, and one has not already been configured.- Throws:
LifecycleException
-
createWebDigester
public static Digester createWebDigester()
Create and return a Digester configured to process the web application deployment descriptor (web.xml).
-
createWebXmlDigester
public static Digester createWebXmlDigester(boolean namespaceAware, boolean validation)
-
createContextDigester
protected static Digester createContextDigester()
Create and return a Digester configured to process the context configuration descriptor for an application.
-
getBaseDir
protected String getBaseDir()
-
defaultConfig
protected void defaultConfig() throws LifecycleExceptionProcess the default configuration file, if it exists. The default config must be read with the container loader - so container servlets can be loaded- Throws:
LifecycleException
-
contextConfig
protected void contextConfig()
Process the default configuration file, if it exists.
-
processContextConfig
protected void processContextConfig(File baseDir, String resourceName)
Process a context.xml.
-
fixDocBase
protected void fixDocBase() throws IOExceptionAdjust docBase.- Throws:
IOException
-
init
protected void init()
Process a "init" event for this Context.
-
start
protected void start() throws LifecycleExceptionProcess a "start" event for this Context - in background- Throws:
LifecycleException
-
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 theokinstance variable tofalseas well).
-
-