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 class
ContextConfig.ContextErrorHandler
-
Field Summary
Fields Modifier and Type Field Description protected static Properties
authenticators
The set of Authenticators that we know how to configure.protected Context
context
The Context we are associated with.protected static Digester
contextDigester
TheDigester
we will use to process web application context files.protected Map<String,Authenticator>
customAuthenticators
protected String
defaultContextXml
The default web application's context file location.protected String
defaultWebXml
The default web application's deployment descriptor location.protected boolean
ok
Track any fatal errors during startup configuration processing.protected SAXParseException
parseException
Any parse error which occurred while parsing XML descriptors.protected static Digester
webDigester
TheDigester
we will use to process web application deployment descriptor files.protected static WebRuleSet
webRuleSet
TheRule
used 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 void
applicationConfig()
Process the application configuration file, if it exists.protected void
authenticatorConfig()
Set up an Authenticator automatically if required, and one has not already been configured.protected void
contextConfig()
Process the default configuration file, if it exists.protected static Digester
createContextDigester()
Create and return a Digester configured to process the context configuration descriptor for an application.static Digester
createWebDigester()
Create and return a Digester configured to process the web application deployment descriptor (web.xml).static Digester
createWebXmlDigester(boolean namespaceAware, boolean validation)
protected void
defaultConfig()
Process the default configuration file, if it exists.protected void
fixDocBase()
Adjust docBase.protected String
getBaseDir()
int
getDebug()
Return the debugging detail level for this component.String
getDefaultContextXml()
Return the location of the default context fileString
getDefaultWebXml()
Return the location of the default deployment descriptorprotected void
init()
Process a "init" event for this Context.void
lifecycleEvent(LifecycleEvent event)
Process the START event for an associated Context.protected void
managerConfig()
Set up a manager.protected void
processContextConfig(File baseDir, String resourceName)
Process a context.xml.void
setClassLoader(ClassLoader cl)
void
setCustomAuthenticators(Map<String,Authenticator> customAuthenticators)
Sets custom mappings of login methods to authenticators.void
setDebug(int debug)
Set the debugging detail level for this component.void
setDefaultContextXml(String path)
Set the location of the default context filevoid
setDefaultWebXml(String path)
Set the location of the default deployment descriptorprotected void
start()
Process a "start" event for this Context - in backgroundprotected void
stop()
Process a "stop" event for this Context.protected void
validateSecurityRoles()
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
TheDigester
we will use to process web application context files.
-
webDigester
protected static final Digester webDigester
TheDigester
we will use to process web application deployment descriptor files.
-
webRuleSet
protected static final WebRuleSet webRuleSet
TheRule
used 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:
lifecycleEvent
in interfaceLifecycleListener
- Parameters:
event
- The lifecycle event that has occurred- Throws:
LifecycleException
-
applicationConfig
protected void applicationConfig() throws LifecycleException
Process the application configuration file, if it exists.- Throws:
LifecycleException
-
managerConfig
protected void managerConfig()
Set up a manager.
-
authenticatorConfig
protected void authenticatorConfig() throws LifecycleException
Set 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 LifecycleException
Process 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 IOException
Adjust docBase.- Throws:
IOException
-
init
protected void init()
Process a "init" event for this Context.
-
start
protected void start() throws LifecycleException
Process 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 theok
instance variable tofalse
as well).
-
-