📄 standarddefaultcontext.java
字号:
* Set the "allow crossing servlet contexts" flag.
*
* @param crossContext The new cross contexts flag
*/
public void setCrossContext(boolean crossContext) {
boolean oldCrossContext = this.crossContext;
this.crossContext = crossContext;
}
/**
* Return descriptive information about this Container implementation and
* the corresponding version number, in the format
* <code><description>/<version></code>.
*/
public String getInfo() {
return (info);
}
/**
* Return the reloadable flag for this web application.
*/
public boolean getReloadable() {
return (this.reloadable);
}
/**
* Set the reloadable flag for this web application.
*
* @param reloadable The new reloadable flag
*/
public void setReloadable(boolean reloadable) {
boolean oldReloadable = this.reloadable;
this.reloadable = reloadable;
}
/**
* Return the swallowOutput flag for this web application.
*/
public boolean getSwallowOutput() {
return (this.swallowOutput);
}
/**
* Set the swallowOutput flag for this web application.
*
* @param swallowOutput The new swallowOutput flag
*/
public void setSwallowOutput(boolean swallowOutput) {
boolean oldSwallowOutput = this.swallowOutput;
this.swallowOutput = swallowOutput;
}
/**
* Return the Java class name of the Wrapper implementation used
* for servlets registered in this Context.
*/
public String getWrapperClass() {
return (this.wrapperClass);
}
/**
* Set the Java class name of the Wrapper implementation used
* for servlets registered in this Context.
*
* @param wrapperClass The new wrapper class
*/
public void setWrapperClass(String wrapperClass) {
this.wrapperClass = wrapperClass;
}
/**
* Set the resources DirContext object with which this Container is
* associated.
*
* @param resources The newly associated DirContext
*/
public void setResources(DirContext resources) {
this.dirContext = resources;
}
/**
* Get the resources DirContext object with which this Container is
* associated.
*
* @param resources The new associated DirContext
*/
public DirContext getResources() {
return this.dirContext;
}
/**
* Return the Loader with which this Container is associated. If there is
* no associated Loader return <code>null</code>.
*/
public Loader getLoader() {
return loader;
}
/**
* Set the Loader with which this Context is associated.
*
* @param loader The newly associated loader
*/
public void setLoader(Loader loader) {
Loader oldLoader = this.loader;
this.loader = loader;
// Report this property change to interested listeners
support.firePropertyChange("loader", oldLoader, this.loader);
}
/**
* Return the Manager with which this Container is associated. If there is
* no associated Manager return <code>null</code>.
*/
public Manager getManager() {
return manager;
}
/**
* Set the Manager with which this Container is associated.
*
* @param manager The newly associated Manager
*/
public void setManager(Manager manager) {
Manager oldManager = this.manager;
this.manager = manager;
// Report this property change to interested listeners
support.firePropertyChange("manager", oldManager, this.manager);
}
// ------------------------------------------------------ Lifecycle Methods
/**
* Add a lifecycle event listener to this component.
*
* @param listener The listener to add
*/
public void addLifecycleListener(LifecycleListener listener) {
lifecycle.add(listener);
}
// ------------------------------------------------------ Public Properties
/**
* The name of this DefaultContext
*/
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
/**
* Return the Container for which this Container is a child, if there is
* one. If there is no defined parent, return <code>null</code>.
*/
public Container getParent() {
return (parent);
}
/**
* 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.
*
* @param container Container to which this Container is being added
* as a child
*
* @exception IllegalArgumentException if this Container refuses to become
* attached to the specified Container
*/
public void setParent(Container container) {
Container oldParent = this.parent;
this.parent = container;
support.firePropertyChange("parent", oldParent, this.parent);
}
// -------------------------------------------------------- Context Methods
/**
* Add a new Listener class name to the set of Listeners
* configured for this application.
*
* @param listener Java class name of a listener class
*/
public void addApplicationListener(String listener) {
synchronized (applicationListeners) {
String results[] =new String[applicationListeners.length + 1];
for (int i = 0; i < applicationListeners.length; i++)
results[i] = applicationListeners[i];
results[applicationListeners.length] = listener;
applicationListeners = results;
}
}
/**
* Add a new application parameter for this application.
*
* @param parameter The new application parameter
*/
public void addApplicationParameter(ApplicationParameter parameter) {
synchronized (applicationParameters) {
ApplicationParameter results[] =
new ApplicationParameter[applicationParameters.length + 1];
System.arraycopy(applicationParameters, 0, results, 0,
applicationParameters.length);
results[applicationParameters.length] = parameter;
applicationParameters = results;
}
}
/**
* Add an EJB resource reference for this web application.
*
* @param ejb New EJB resource reference
*/
public void addEjb(ContextEjb ejb) {
namingResources.addEjb(ejb);
}
/**
* Add an environment entry for this web application.
*
* @param environment New environment entry
*/
public void addEnvironment(ContextEnvironment environment) {
namingResources.addEnvironment(environment);
}
/**
* Add resource parameters for this web application.
*
* @param resourceParameters New resource parameters
*/
public void addResourceParams(ResourceParams resourceParameters) {
namingResources.addResourceParams(resourceParameters);
}
/**
* Add the classname of an InstanceListener to be added to each
* Wrapper appended to this Context.
*
* @param listener Java class name of an InstanceListener class
*/
public void addInstanceListener(String listener) {
synchronized (instanceListeners) {
String results[] =new String[instanceListeners.length + 1];
for (int i = 0; i < instanceListeners.length; i++)
results[i] = instanceListeners[i];
results[instanceListeners.length] = listener;
instanceListeners = results;
}
}
/**
* Add a new context initialization parameter, replacing any existing
* value for the specified name.
*
* @param name Name of the new parameter
* @param value Value of the new parameter
*
* @exception IllegalArgumentException if the name or value is missing,
* or if this context initialization parameter has already been
* registered
*/
public void addParameter(String name, String value) {
// Validate the proposed context initialization parameter
if ((name == null) || (value == null))
throw new IllegalArgumentException
(sm.getString("standardContext.parameter.required"));
if (parameters.get(name) != null)
throw new IllegalArgumentException
(sm.getString("standardContext.parameter.duplicate", name));
// Add this parameter to our defined set
synchronized (parameters) {
parameters.put(name, value);
}
}
/**
* Add a property change listener to this component.
*
* @param listener The listener to add
*/
public void addPropertyChangeListener(PropertyChangeListener listener) {
support.addPropertyChangeListener(listener);
}
/**
* Add a resource reference for this web application.
*
* @param resource New resource reference
*/
public void addResource(ContextResource resource) {
namingResources.addResource(resource);
}
/**
* Add a resource environment reference for this web application.
*
* @param name The resource environment reference name
* @param type The resource environment reference type
*/
public void addResourceEnvRef(String name, String type) {
namingResources.addResourceEnvRef(name, type);
}
/**
* Add a resource link for this web application.
*
* @param resource New resource link
*/
public void addResourceLink(ContextResourceLink resourceLink) {
namingResources.addResourceLink(resourceLink);
}
/**
* Add the classname of a LifecycleListener to be added to each
* Wrapper appended to this Context.
*
* @param listener Java class name of a LifecycleListener class
*/
public void addWrapperLifecycle(String listener) {
synchronized (wrapperLifecycles) {
String results[] =new String[wrapperLifecycles.length + 1];
for (int i = 0; i < wrapperLifecycles.length; i++)
results[i] = wrapperLifecycles[i];
results[wrapperLifecycles.length] = listener;
wrapperLifecycles = results;
}
}
/**
* Add the classname of a ContainerListener to be added to each
* Wrapper appended to this Context.
*
* @param listener Java class name of a ContainerListener class
*/
public void addWrapperListener(String listener) {
synchronized (wrapperListeners) {
String results[] =new String[wrapperListeners.length + 1];
for (int i = 0; i < wrapperListeners.length; i++)
results[i] = wrapperListeners[i];
results[wrapperListeners.length] = listener;
wrapperListeners = results;
}
}
/**
* Return the set of application listener class names configured
* for this application.
*/
public String[] findApplicationListeners() {
return (applicationListeners);
}
/**
* Return the set of application parameters for this application.
*/
public ApplicationParameter[] findApplicationParameters() {
return (applicationParameters);
}
/**
* Return the EJB resource reference with the specified name, if any;
* otherwise, return <code>null</code>.
*
* @param name Name of the desired EJB resource reference
*/
public ContextEjb findEjb(String name) {
return namingResources.findEjb(name);
}
/**
* Return the defined EJB resource references for this application.
* If there are none, a zero-length array is returned.
*/
public ContextEjb[] findEjbs() {
return namingResources.findEjbs();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -