org.apache.catalina.core
Class StandardDefaultContext

java.lang.Object
  extended byorg.apache.catalina.core.StandardDefaultContext
All Implemented Interfaces:
DefaultContext, LifecycleListener

public class StandardDefaultContext
extends java.lang.Object
implements DefaultContext, LifecycleListener

Used to store the default configuration a Host will use when creating a Context. A Context configured in server.xml can override these defaults by setting the Context attribute override="true".

Version:
$Revision: 1.13 $ $Date: 2004/08/26 21:32:20 $
Author:
Glenn Nielsen

Field Summary
protected  java.util.Vector lifecycle
          The Context LifecycleListener's
protected  Loader loader
          The Loader implementation with which this Container is associated.
protected  Manager manager
          The Manager implementation with which this Container is associated.
protected  java.lang.String name
          The human-readable name of this Container.
protected  Container parent
          The parent Container to which this Container is a child.
protected static StringManager sm
          The string manager for this package.
protected  java.beans.PropertyChangeSupport support
          The property change support for this component.
 
Constructor Summary
StandardDefaultContext()
          Create the DefaultContext
 
Method Summary
 void addApplicationListener(java.lang.String listener)
          Add a new Listener class name to the set of Listeners configured for this application.
 void addApplicationParameter(ApplicationParameter parameter)
          Add a new application parameter for this application.
 void addEjb(ContextEjb ejb)
          Add an EJB resource reference for this web application.
 void addEnvironment(ContextEnvironment environment)
          Add an environment entry for this web application.
 void addInstanceListener(java.lang.String listener)
          Add the classname of an InstanceListener to be added to each Wrapper appended to this Context.
 void addLifecycleListener(LifecycleListener listener)
          Add a lifecycle event listener to this component.
 void addParameter(java.lang.String name, java.lang.String value)
          Add a new context initialization parameter, replacing any existing value for the specified name.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 void addResource(ContextResource resource)
          Add a resource reference for this web application.
 void addResourceEnvRef(java.lang.String name, java.lang.String type)
          Add a resource environment reference for this web application.
 void addResourceLink(ContextResourceLink resourceLink)
          Add a resource link for this web application.
 void addResourceParams(ResourceParams resourceParameters)
          Add resource parameters for this web application.
 void addWrapperLifecycle(java.lang.String listener)
          Add the classname of a LifecycleListener to be added to each Wrapper appended to this Context.
 void addWrapperListener(java.lang.String listener)
          Add the classname of a ContainerListener to be added to each Wrapper appended to this Context.
 java.lang.String[] findApplicationListeners()
          Return the set of application listener class names configured for this application.
 ApplicationParameter[] findApplicationParameters()
          Return the set of application parameters for this application.
 ContextEjb findEjb(java.lang.String name)
          Return the EJB resource reference with the specified name, if any; otherwise, return null.
 ContextEjb[] findEjbs()
          Return the defined EJB resource references for this application.
 ContextEnvironment findEnvironment(java.lang.String name)
          Return the environment entry with the specified name, if any; otherwise, return null.
 ContextEnvironment[] findEnvironments()
          Return the set of defined environment entries for this web application.
 java.lang.String[] findInstanceListeners()
          Return the set of InstanceListener classes that will be added to newly created Wrappers automatically.
 java.lang.String findParameter(java.lang.String name)
          Return the value for the specified context initialization parameter name, if any; otherwise return null.
 java.lang.String[] findParameters()
          Return the names of all defined context initialization parameters for this Context.
 ContextResource findResource(java.lang.String name)
          Return the resource reference with the specified name, if any; otherwise return null.
 java.lang.String findResourceEnvRef(java.lang.String name)
          Return the resource environment reference type for the specified name, if any; otherwise return null.
 java.lang.String[] findResourceEnvRefs()
          Return the set of resource environment reference names for this web application.
 ContextResourceLink findResourceLink(java.lang.String name)
          Return the resource link with the specified name, if any; otherwise return null.
 ContextResourceLink[] findResourceLinks()
          Return the defined resource links for this application.
 ResourceParams[] findResourceParams()
          Return the set of defined resource parameters for this web application.
 ContextResource[] findResources()
          Return the defined resource references for this application.
 java.lang.String[] findWrapperLifecycles()
          Return the set of LifecycleListener classes that will be added to newly created Wrappers automatically.
 java.lang.String[] findWrapperListeners()
          Return the set of ContainerListener classes that will be added to newly created Wrappers automatically.
 boolean getCookies()
          Return the "use cookies for session ids" flag.
 boolean getCrossContext()
          Return the "allow crossing servlet contexts" flag.
 java.lang.String getInfo()
          Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.
 Loader getLoader()
          Return the Loader with which this Container is associated.
 Manager getManager()
          Return the Manager with which this Container is associated.
 java.lang.String getName()
          The name of this DefaultContext
 NamingResources getNamingResources()
          Return the naming resources associated with this web application.
 Container getParent()
          Return the Container for which this Container is a child, if there is one.
 boolean getReloadable()
          Return the reloadable flag for this web application.
 javax.naming.directory.DirContext getResources()
          Get the resources DirContext object with which this Container is associated.
 boolean getSwallowOutput()
          Return the swallowOutput flag for this web application.
 java.lang.String getWrapperClass()
          Return the Java class name of the Wrapper implementation used for servlets registered in this Context.
 void importDefaultContext(Context context)
          Import the configuration from the DefaultContext into current Context.
 void installDefaultContext(Context context)
          Install the StandardContext portion of the DefaultContext configuration into current Context.
 boolean isUseNaming()
          Returns true if the internal naming support is used.
 void lifecycleEvent(LifecycleEvent event)
          Process the START event for an associated Context.
 void removeApplicationListener(java.lang.String listener)
          Remove the specified application listener class from the set of listeners for this application.
 void removeApplicationParameter(java.lang.String name)
          Remove the application parameter with the specified name from the set for this application.
 void removeEjb(java.lang.String name)
          Remove any EJB resource reference with the specified name.
 void removeEnvironment(java.lang.String name)
          Remove any environment entry with the specified name.
 void removeInstanceListener(java.lang.String listener)
          Remove a class name from the set of InstanceListener classes that will be added to newly created Wrappers.
 void removeParameter(java.lang.String name)
          Remove the context initialization parameter with the specified name, if it exists; otherwise, no action is taken.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a property change listener from this component.
 void removeResource(java.lang.String name)
          Remove any resource reference with the specified name.
 void removeResourceEnvRef(java.lang.String name)
          Remove any resource environment reference with the specified name.
 void removeResourceLink(java.lang.String name)
          Remove any resource link with the specified name.
 void removeWrapperLifecycle(java.lang.String listener)
          Remove a class name from the set of LifecycleListener classes that will be added to newly created Wrappers.
 void removeWrapperListener(java.lang.String listener)
          Remove a class name from the set of ContainerListener classes that will be added to newly created Wrappers.
 void setCookies(boolean cookies)
          Set the "use cookies for session ids" flag.
 void setCrossContext(boolean crossContext)
          Set the "allow crossing servlet contexts" flag.
 void setLoader(Loader loader)
          Set the Loader with which this Context is associated.
 void setManager(Manager manager)
          Set the Manager with which this Container is associated.
 void setName(java.lang.String name)
          Set the name of the default context.
 void setParent(Container container)
          Set the parent Container to which this Container is being added as a child.
 void setReloadable(boolean reloadable)
          Set the reloadable flag for this web application.
 void setResources(javax.naming.directory.DirContext resources)
          Set the resources DirContext object with which this Container is associated.
 void setSwallowOutput(boolean swallowOutput)
          Set the swallowOutput flag for this web application.
 void setUseNaming(boolean useNaming)
          Enables or disables naming.
 void setWrapperClass(java.lang.String wrapperClass)
          Set the Java class name of the Wrapper implementation used for servlets registered in this Context.
 java.lang.String toString()
          Return a String representation of this component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The human-readable name of this Container.


parent

protected Container parent
The parent Container to which this Container is a child.


loader

protected Loader loader
The Loader implementation with which this Container is associated.


manager

protected Manager manager
The Manager implementation with which this Container is associated.


lifecycle

protected java.util.Vector lifecycle
The Context LifecycleListener's


sm

protected static StringManager sm
The string manager for this package.


support

protected java.beans.PropertyChangeSupport support
The property change support for this component.

Constructor Detail

StandardDefaultContext

public StandardDefaultContext()
Create the DefaultContext

Method Detail

isUseNaming

public boolean isUseNaming()
Returns true if the internal naming support is used.


setUseNaming

public void setUseNaming(boolean useNaming)
Enables or disables naming.


getCookies

public boolean getCookies()
Return the "use cookies for session ids" flag.

Specified by:
getCookies in interface DefaultContext

setCookies

public void setCookies(boolean cookies)
Set the "use cookies for session ids" flag.

Specified by:
setCookies in interface DefaultContext
Parameters:
cookies - The new flag

getCrossContext

public boolean getCrossContext()
Return the "allow crossing servlet contexts" flag.

Specified by:
getCrossContext in interface DefaultContext

setCrossContext

public void setCrossContext(boolean crossContext)
Set the "allow crossing servlet contexts" flag.

Specified by:
setCrossContext in interface DefaultContext
Parameters:
crossContext - The new cross contexts flag

getInfo

public java.lang.String getInfo()
Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface DefaultContext

getReloadable

public boolean getReloadable()
Return the reloadable flag for this web application.

Specified by:
getReloadable in interface DefaultContext

setReloadable

public void setReloadable(boolean reloadable)
Set the reloadable flag for this web application.

Specified by:
setReloadable in interface DefaultContext
Parameters:
reloadable - The new reloadable flag

getSwallowOutput

public boolean getSwallowOutput()
Return the swallowOutput flag for this web application.


setSwallowOutput

public void setSwallowOutput(boolean swallowOutput)
Set the swallowOutput flag for this web application.

Parameters:
swallowOutput - The new swallowOutput flag

getWrapperClass

public java.lang.String getWrapperClass()
Return the Java class name of the Wrapper implementation used for servlets registered in this Context.

Specified by:
getWrapperClass in interface DefaultContext

setWrapperClass

public void setWrapperClass(java.lang.String wrapperClass)
Set the Java class name of the Wrapper implementation used for servlets registered in this Context.

Specified by:
setWrapperClass in interface DefaultContext
Parameters:
wrapperClass - The new wrapper class

setResources

public void setResources(javax.naming.directory.DirContext resources)
Set the resources DirContext object with which this Container is associated.

Specified by:
setResources in interface DefaultContext
Parameters:
resources - The newly associated DirContext

getResources

public javax.naming.directory.DirContext getResources()
Get the resources DirContext object with which this Container is associated.

Specified by:
getResources in interface DefaultContext

getLoader

public Loader getLoader()
Return the Loader with which this Container is associated. If there is no associated Loader return null.

Specified by:
getLoader in interface DefaultContext

setLoader

public void setLoader(Loader loader)
Set the Loader with which this Context is associated.

Specified by:
setLoader in interface DefaultContext
Parameters:
loader - The newly associated loader

getManager

public Manager getManager()
Return the Manager with which this Container is associated. If there is no associated Manager return null.

Specified by:
getManager in interface DefaultContext

setManager

public void setManager(Manager manager)
Set the Manager with which this Container is associated.

Specified by:
setManager in interface DefaultContext
Parameters:
manager - The newly associated Manager

addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.

Parameters:
listener - The listener to add

getName

public java.lang.String getName()
The name of this DefaultContext

Specified by:
getName in interface DefaultContext

setName

public void setName(java.lang.String name)
Description copied from interface: DefaultContext
Set the name of the default context.

Specified by:
setName in interface DefaultContext
Parameters:
name - The new name

getParent

public Container getParent()
Return the Container for which this Container is a child, if there is one. If there is no defined parent, return null.

Specified by:
getParent in interface DefaultContext

setParent

public void setParent(Container container)
Set the parent Container to which this Container is being added as a child. This Container may refuse to become attached to the specified Container by throwing an exception.

Specified by:
setParent in interface DefaultContext
Parameters:
container - Container to which this Container is being added as a child
Throws:
java.lang.IllegalArgumentException - if this Container refuses to become attached to the specified Container

addApplicationListener

public void addApplicationListener(java.lang.String listener)
Add a new Listener class name to the set of Listeners configured for this application.

Specified by:
addApplicationListener in interface DefaultContext
Parameters:
listener - Java class name of a listener class

addApplicationParameter

public void addApplicationParameter(ApplicationParameter parameter)
Add a new application parameter for this application.

Specified by:
addApplicationParameter in interface DefaultContext
Parameters:
parameter - The new application parameter

addEjb

public void addEjb(ContextEjb ejb)
Add an EJB resource reference for this web application.

Specified by:
addEjb in interface DefaultContext
Parameters:
ejb - New EJB resource reference

addEnvironment

public void addEnvironment(ContextEnvironment environment)
Add an environment entry for this web application.

Specified by:
addEnvironment in interface DefaultContext
Parameters:
environment - New environment entry

addResourceParams

public void addResourceParams(ResourceParams resourceParameters)
Add resource parameters for this web application.

Specified by:
addResourceParams in interface DefaultContext
Parameters:
resourceParameters - New resource parameters

addInstanceListener

public void addInstanceListener(java.lang.String listener)
Add the classname of an InstanceListener to be added to each Wrapper appended to this Context.

Specified by:
addInstanceListener in interface DefaultContext
Parameters:
listener - Java class name of an InstanceListener class

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)
Add a new context initialization parameter, replacing any existing value for the specified name.

Specified by:
addParameter in interface DefaultContext
Parameters:
name - Name of the new parameter
value - Value of the new parameter
Throws:
java.lang.IllegalArgumentException - if the name or value is missing, or if this context initialization parameter has already been registered

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component.

Specified by:
addPropertyChangeListener in interface DefaultContext
Parameters:
listener - The listener to add

addResource

public void addResource(ContextResource resource)
Add a resource reference for this web application.

Specified by:
addResource in interface DefaultContext
Parameters:
resource - New resource reference

addResourceEnvRef

public void addResourceEnvRef(java.lang.String name,
                              java.lang.String type)
Add a resource environment reference for this web application.

Specified by:
addResourceEnvRef in interface DefaultContext
Parameters:
name - The resource environment reference name
type - The resource environment reference type

addResourceLink

public void addResourceLink(ContextResourceLink resourceLink)
Add a resource link for this web application.

Specified by:
addResourceLink in interface DefaultContext

addWrapperLifecycle

public void addWrapperLifecycle(java.lang.String listener)
Add the classname of a LifecycleListener to be added to each Wrapper appended to this Context.

Specified by:
addWrapperLifecycle in interface DefaultContext
Parameters:
listener - Java class name of a LifecycleListener class

addWrapperListener

public void addWrapperListener(java.lang.String listener)
Add the classname of a ContainerListener to be added to each Wrapper appended to this Context.

Specified by:
addWrapperListener in interface DefaultContext
Parameters:
listener - Java class name of a ContainerListener class

findApplicationListeners

public java.lang.String[] findApplicationListeners()
Return the set of application listener class names configured for this application.

Specified by:
findApplicationListeners in interface DefaultContext

findApplicationParameters

public ApplicationParameter[] findApplicationParameters()
Return the set of application parameters for this application.

Specified by:
findApplicationParameters in interface DefaultContext

findEjb

public ContextEjb findEjb(java.lang.String name)
Return the EJB resource reference with the specified name, if any; otherwise, return null.

Specified by:
findEjb in interface DefaultContext
Parameters:
name - Name of the desired EJB resource reference

findEjbs

public ContextEjb[] findEjbs()
Return the defined EJB resource references for this application. If there are none, a zero-length array is returned.

Specified by:
findEjbs in interface DefaultContext

findEnvironment

public ContextEnvironment findEnvironment(java.lang.String name)
Return the environment entry with the specified name, if any; otherwise, return null.

Specified by:
findEnvironment in interface DefaultContext
Parameters:
name - Name of the desired environment entry

findEnvironments

public ContextEnvironment[] findEnvironments()
Return the set of defined environment entries for this web application. If none have been defined, a zero-length array is returned.

Specified by:
findEnvironments in interface DefaultContext

findResourceParams

public ResourceParams[] findResourceParams()
Return the set of defined resource parameters for this web application. If none have been defined, a zero-length array is returned.

Specified by:
findResourceParams in interface DefaultContext

findInstanceListeners

public java.lang.String[] findInstanceListeners()
Return the set of InstanceListener classes that will be added to newly created Wrappers automatically.

Specified by:
findInstanceListeners in interface DefaultContext

findParameter

public java.lang.String findParameter(java.lang.String name)
Return the value for the specified context initialization parameter name, if any; otherwise return null.

Specified by:
findParameter in interface DefaultContext
Parameters:
name - Name of the parameter to return

findParameters

public java.lang.String[] findParameters()
Return the names of all defined context initialization parameters for this Context. If no parameters are defined, a zero-length array is returned.

Specified by:
findParameters in interface DefaultContext

findResource

public ContextResource findResource(java.lang.String name)
Return the resource reference with the specified name, if any; otherwise return null.

Specified by:
findResource in interface DefaultContext
Parameters:
name - Name of the desired resource reference

findResourceEnvRef

public java.lang.String findResourceEnvRef(java.lang.String name)
Return the resource environment reference type for the specified name, if any; otherwise return null.

Specified by:
findResourceEnvRef in interface DefaultContext
Parameters:
name - Name of the desired resource environment reference

findResourceEnvRefs

public java.lang.String[] findResourceEnvRefs()
Return the set of resource environment reference names for this web application. If none have been specified, a zero-length array is returned.

Specified by:
findResourceEnvRefs in interface DefaultContext

findResourceLink

public ContextResourceLink findResourceLink(java.lang.String name)
Return the resource link with the specified name, if any; otherwise return null.

Specified by:
findResourceLink in interface DefaultContext
Parameters:
name - Name of the desired resource link

findResourceLinks

public ContextResourceLink[] findResourceLinks()
Return the defined resource links for this application. If none have been defined, a zero-length array is returned.

Specified by:
findResourceLinks in interface DefaultContext

findResources

public ContextResource[] findResources()
Return the defined resource references for this application. If none have been defined, a zero-length array is returned.

Specified by:
findResources in interface DefaultContext

findWrapperLifecycles

public java.lang.String[] findWrapperLifecycles()
Return the set of LifecycleListener classes that will be added to newly created Wrappers automatically.

Specified by:
findWrapperLifecycles in interface DefaultContext

findWrapperListeners

public java.lang.String[] findWrapperListeners()
Return the set of ContainerListener classes that will be added to newly created Wrappers automatically.

Specified by:
findWrapperListeners in interface DefaultContext

getNamingResources

public NamingResources getNamingResources()
Return the naming resources associated with this web application.

Specified by:
getNamingResources in interface DefaultContext

removeApplicationListener

public void removeApplicationListener(java.lang.String listener)
Remove the specified application listener class from the set of listeners for this application.

Specified by:
removeApplicationListener in interface DefaultContext
Parameters:
listener - Java class name of the listener to be removed

removeApplicationParameter

public void removeApplicationParameter(java.lang.String name)
Remove the application parameter with the specified name from the set for this application.

Specified by:
removeApplicationParameter in interface DefaultContext
Parameters:
name - Name of the application parameter to remove

removeEjb

public void removeEjb(java.lang.String name)
Remove any EJB resource reference with the specified name.

Specified by:
removeEjb in interface DefaultContext
Parameters:
name - Name of the EJB resource reference to remove

removeEnvironment

public void removeEnvironment(java.lang.String name)
Remove any environment entry with the specified name.

Specified by:
removeEnvironment in interface DefaultContext
Parameters:
name - Name of the environment entry to remove

removeInstanceListener

public void removeInstanceListener(java.lang.String listener)
Remove a class name from the set of InstanceListener classes that will be added to newly created Wrappers.

Specified by:
removeInstanceListener in interface DefaultContext
Parameters:
listener - Class name of an InstanceListener class to be removed

removeParameter

public void removeParameter(java.lang.String name)
Remove the context initialization parameter with the specified name, if it exists; otherwise, no action is taken.

Specified by:
removeParameter in interface DefaultContext
Parameters:
name - Name of the parameter to remove

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.

Specified by:
removePropertyChangeListener in interface DefaultContext
Parameters:
listener - The listener to remove

removeResource

public void removeResource(java.lang.String name)
Remove any resource reference with the specified name.

Specified by:
removeResource in interface DefaultContext
Parameters:
name - Name of the resource reference to remove

removeResourceEnvRef

public void removeResourceEnvRef(java.lang.String name)
Remove any resource environment reference with the specified name.

Specified by:
removeResourceEnvRef in interface DefaultContext
Parameters:
name - Name of the resource environment reference to remove

removeResourceLink

public void removeResourceLink(java.lang.String name)
Remove any resource link with the specified name.

Specified by:
removeResourceLink in interface DefaultContext
Parameters:
name - Name of the resource link to remove

removeWrapperLifecycle

public void removeWrapperLifecycle(java.lang.String listener)
Remove a class name from the set of LifecycleListener classes that will be added to newly created Wrappers.

Specified by:
removeWrapperLifecycle in interface DefaultContext
Parameters:
listener - Class name of a LifecycleListener class to be removed

removeWrapperListener

public void removeWrapperListener(java.lang.String listener)
Remove a class name from the set of ContainerListener classes that will be added to newly created Wrappers.

Specified by:
removeWrapperListener in interface DefaultContext
Parameters:
listener - Class name of a ContainerListener class to be removed

lifecycleEvent

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

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

installDefaultContext

public void installDefaultContext(Context context)
Install the StandardContext portion of the DefaultContext configuration into current Context.

Parameters:
context - current web application context

importDefaultContext

public void importDefaultContext(Context context)
Import the configuration from the DefaultContext into current Context.

Specified by:
importDefaultContext in interface DefaultContext
Parameters:
context - current web application context

toString

public java.lang.String toString()
Return a String representation of this component.



Copyright 2000-2002 Apache Software Foundation. All Rights Reserved.