org.apache.catalina.startup
Class ContextConfig

java.lang.Object
  extended byorg.apache.catalina.startup.ContextConfig
All Implemented Interfaces:
LifecycleListener

public class ContextConfig
extends java.lang.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 1392228 2012-10-01 08:24:04Z markt $
Author:
Craig R. McClanahan, Jean-Francois Arcand

Nested Class Summary
protected  class ContextConfig.ContextErrorHandler
           
 
Field Summary
protected static java.util.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
          The Digester we will use to process web application context files.
protected  java.util.Map customAuthenticators
           
protected  java.lang.String defaultContextXml
          The default web application's context file location.
protected  java.lang.String defaultWebXml
          The default web application's deployment descriptor location.
protected static long deploymentCount
          Deployment count.
protected static LoginConfig DUMMY_LOGIN_CONFIG
           
protected static org.apache.commons.logging.Log log
           
protected  boolean ok
          Track any fatal errors during startup configuration processing.
protected  java.lang.String originalDocBase
          Original docBase.
protected  org.xml.sax.SAXParseException parseException
          Any parse error which occurred while parsing XML descriptors.
protected static StringManager sm
          The string resources for this package.
protected static Digester webDigester
          The Digester we will use to process web application deployment descriptor files.
protected static WebRuleSet webRuleSet
          The Rule used to parse the web.xml
protected static boolean xmlNamespaceAware
          Attribute value used to turn on/off XML namespace awarenes.
protected static boolean xmlValidation
          Attribute value used to turn on/off XML validation
 
Constructor Summary
ContextConfig()
           
 
Method Summary
protected  void antiLocking()
           
protected  void applicationWebConfig()
          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 beforeStart()
          Process a "before start" event for this Context.
protected  void contextConfig()
          Process the default configuration file, if it exists.
protected  Digester createContextDigester()
          Create (if necessary) and return a Digester configured to process the context configuration descriptor for an application.
protected static Digester createWebDigester()
          Create (if necessary) and return a Digester configured to process the web application deployment descriptor (web.xml).
static Digester createWebXmlDigester(boolean namespaceAware, boolean validation)
          Create (if necessary) and return a Digester configured to process the web application deployment descriptor (web.xml).
protected  void defaultWebConfig()
          Process the default configuration file, if it exists.
protected  void destroy()
          Process a "destroy" event for this Context.
protected  void fixDocBase()
          Adjust docBase.
protected  java.lang.String getBaseDir()
           
protected  java.io.File getConfigBase()
          Get config base.
 java.lang.String getDefaultContextXml()
          Return the location of the default context file
 java.lang.String getDefaultWebXml()
          Return the location of the default deployment descriptor
protected  java.lang.String getHostConfigPath(java.lang.String resourceName)
           
protected  void init()
          Process a "init" event for this Context.
 void lifecycleEvent(LifecycleEvent event)
          Process events for an associated Context.
protected  void processContextConfig(java.io.File baseDir, java.lang.String resourceName)
          Process a context.xml.
protected  void processDefaultWebConfig(Digester digester, java.io.InputStream stream, org.xml.sax.InputSource source)
          Process a default web.xml.
 void setCustomAuthenticators(java.util.Map customAuthenticators)
          Sets custom mappings of login methods to authenticators.
 void setDefaultContextXml(java.lang.String path)
          Set the location of the default context file
 void setDefaultWebXml(java.lang.String path)
          Set the location of the default deployment descriptor
protected  void start()
          Process a "start" event for this Context.
protected  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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

customAuthenticators

protected java.util.Map customAuthenticators

authenticators

protected static java.util.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 java.lang.String defaultContextXml
The default web application's context file location.


defaultWebXml

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


ok

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


parseException

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


originalDocBase

protected java.lang.String originalDocBase
Original docBase.


sm

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


contextDigester

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


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


xmlValidation

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


xmlNamespaceAware

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


deploymentCount

protected static long deploymentCount
Deployment count.


DUMMY_LOGIN_CONFIG

protected static final LoginConfig DUMMY_LOGIN_CONFIG
Constructor Detail

ContextConfig

public ContextConfig()
Method Detail

getDefaultWebXml

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


setDefaultWebXml

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

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

getDefaultContextXml

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


setDefaultContextXml

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

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

setCustomAuthenticators

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

Parameters:
customAuthenticators - Custom mappings of login methods to authenticators

lifecycleEvent

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

Specified by:
lifecycleEvent in interface LifecycleListener
Parameters:
event - The lifecycle event that has occurred

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.


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).


createContextDigester

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


getBaseDir

protected java.lang.String getBaseDir()

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


processDefaultWebConfig

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


contextConfig

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


processContextConfig

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


fixDocBase

protected void fixDocBase()
                   throws java.io.IOException
Adjust docBase.

Throws:
java.io.IOException

antiLocking

protected void antiLocking()
                    throws java.io.IOException
Throws:
java.io.IOException

init

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


beforeStart

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


start

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


stop

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


destroy

protected void destroy()
Process a "destroy" 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).


getConfigBase

protected java.io.File getConfigBase()
Get config base.


getHostConfigPath

protected java.lang.String getHostConfigPath(java.lang.String resourceName)


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.