import org.apache.catalina.startup.TldConfig;
import org.apache.catalina.util.CharsetMapper;
import org.apache.catalina.util.ExtensionValidator;
-import org.apache.catalina.util.LifecycleBase;
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.URLEncoder;
import org.apache.juli.logging.Log;
// ----------------------------------------------------- Context Properties
+ @Override
public int getEffectiveMajorVersion() {
return effectiveMajorVersion;
}
+ @Override
public void setEffectiveMajorVersion(int effectiveMajorVersion) {
this.effectiveMajorVersion = effectiveMajorVersion;
}
+ @Override
public int getEffectiveMinorVersion() {
return effectiveMinorVersion;
}
+ @Override
public void setEffectiveMinorVersion(int effectiveMinorVersion) {
this.effectiveMinorVersion = effectiveMinorVersion;
}
+ @Override
public void setLogEffectiveWebXml(boolean logEffectiveWebXml) {
this.logEffectiveWebXml = logEffectiveWebXml;
}
+ @Override
public boolean getLogEffectiveWebXml() {
return logEffectiveWebXml;
}
+ @Override
public Authenticator getAuthenticator() {
if (this instanceof Authenticator)
return (Authenticator) this;
return null;
}
+ @Override
public JarScanner getJarScanner() {
if (jarScanner == null) {
jarScanner = new StandardJarScanner();
}
+ @Override
public void setJarScanner(JarScanner jarScanner) {
this.jarScanner = jarScanner;
}
}
+ @Override
public String getEncodedPath() {
return encodedPath;
}
* META-INF/resources directory that should be included in the static
* resources for this context.
*/
+ @Override
public void addResourceJarUrl(URL url) {
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).addResourcesJar(url);
* @param classes The classes in which the initializer expressed an
* interest
*/
+ @Override
public void addServletContainerInitializer(
ServletContainerInitializer sci, Set<Class<?>> classes) {
initializers.put(sci, classes);
* @exception IllegalStateException if this method is called before
* this application has started, or after it has been stopped
*/
+ @Override
public Object[] getApplicationEventListeners() {
return (applicationEventListenersObjects);
}
*
* @param listeners The set of instantiated listener objects.
*/
+ @Override
public void setApplicationEventListeners(Object listeners[]) {
applicationEventListenersObjects = listeners;
}
* @exception IllegalStateException if this method is called before
* this application has started, or after it has been stopped
*/
+ @Override
public Object[] getApplicationLifecycleListeners() {
return (applicationLifecycleListenersObjects);
}
*
* @param listeners The set of instantiated listener objects.
*/
+ @Override
public void setApplicationLifecycleListeners(Object listeners[]) {
applicationLifecycleListenersObjects = listeners;
}
/**
* Return the application available flag for this Context.
*/
+ @Override
public boolean getAvailable() {
// TODO Remove this method entirely
/**
* Return the Locale to character set mapper for this Context.
*/
+ @Override
public CharsetMapper getCharsetMapper() {
// Create a mapper the first time it is requested
*
* @param mapper The new mapper
*/
+ @Override
public void setCharsetMapper(CharsetMapper mapper) {
CharsetMapper oldCharsetMapper = this.charsetMapper;
/**
* Return the URL of the XML descriptor for this context.
*/
+ @Override
public URL getConfigFile() {
return (this.configFile);
*
* @param configFile The URL of the XML descriptor for this context.
*/
+ @Override
public void setConfigFile(URL configFile) {
this.configFile = configFile;
/**
* Return the "correctly configured" flag for this Context.
*/
+ @Override
public boolean getConfigured() {
return (this.configured);
*
* @param configured The new correctly configured flag
*/
+ @Override
public void setConfigured(boolean configured) {
boolean oldConfigured = this.configured;
/**
* Return the "use cookies for session ids" flag.
*/
+ @Override
public boolean getCookies() {
return (this.cookies);
*
* @param cookies The new flag
*/
+ @Override
public void setCookies(boolean cookies) {
boolean oldCookies = this.cookies;
* @return The value of the default session cookie name or null if not
* specified
*/
+ @Override
public String getSessionCookieName() {
return sessionCookieName;
}
*
* @param sessionCookieName The name to use
*/
+ @Override
public void setSessionCookieName(String sessionCookieName) {
String oldSessionCookieName = this.sessionCookieName;
this.sessionCookieName = sessionCookieName;
* @return <code>true</code> if the HttpOnly flag should be set on session
* cookies
*/
+ @Override
public boolean getUseHttpOnly() {
return useHttpOnly;
}
* @param useHttpOnly Set to <code>true</code> to use HttpOnly cookies
* for session cookies
*/
+ @Override
public void setUseHttpOnly(boolean useHttpOnly) {
boolean oldUseHttpOnly = this.useHttpOnly;
this.useHttpOnly = useHttpOnly;
* @return The value of the default session cookie domain or null if not
* specified
*/
+ @Override
public String getSessionCookieDomain() {
return sessionCookieDomain;
}
*
* @param sessionCookieDomain The domain to use
*/
+ @Override
public void setSessionCookieDomain(String sessionCookieDomain) {
String oldSessionCookieDomain = this.sessionCookieDomain;
this.sessionCookieDomain = sessionCookieDomain;
* @return The value of the default session cookie path or null if not
* specified
*/
+ @Override
public String getSessionCookiePath() {
return sessionCookiePath;
}
*
* @param sessionCookiePath The path to use
*/
+ @Override
public void setSessionCookiePath(String sessionCookiePath) {
String oldSessionCookiePath = this.sessionCookiePath;
this.sessionCookiePath = sessionCookiePath;
/**
* Return the "allow crossing servlet contexts" flag.
*/
+ @Override
public boolean getCrossContext() {
return (this.crossContext);
*
* @param crossContext The new cross contexts flag
*/
+ @Override
public void setCrossContext(boolean crossContext) {
boolean oldCrossContext = this.crossContext;
/**
* Return the display name of this web application.
*/
+ @Override
public String getDisplayName() {
return (this.displayName);
/**
* Return the alternate Deployment Descriptor name.
*/
+ @Override
public String getAltDDName(){
return altDDName;
}
/**
* Set an alternate Deployment Descriptor name.
*/
+ @Override
public void setAltDDName(String altDDName) {
this.altDDName = altDDName;
if (context != null) {
*
* @param displayName The new display name
*/
+ @Override
public void setDisplayName(String displayName) {
String oldDisplayName = this.displayName;
/**
* Return the distributable flag for this web application.
*/
+ @Override
public boolean getDistributable() {
return (this.distributable);
*
* @param distributable The new distributable flag
*/
+ @Override
public void setDistributable(boolean distributable) {
boolean oldDistributable = this.distributable;
this.distributable = distributable;
* Return the document root for this Context. This can be an absolute
* pathname, a relative pathname, or a URL.
*/
+ @Override
public String getDocBase() {
return (this.docBase);
*
* @param docBase The new document root
*/
+ @Override
public void setDocBase(String docBase) {
this.docBase = docBase;
/**
* Return the boolean on the annotations parsing.
*/
+ @Override
public boolean getIgnoreAnnotations() {
return this.ignoreAnnotations;
}
*
* @param ignoreAnnotations The boolean on the annotations parsing
*/
+ @Override
public void setIgnoreAnnotations(boolean ignoreAnnotations) {
boolean oldIgnoreAnnotations = this.ignoreAnnotations;
this.ignoreAnnotations = ignoreAnnotations;
/**
* Return the login configuration descriptor for this web application.
*/
+ @Override
public LoginConfig getLoginConfig() {
return (this.loginConfig);
*
* @param config The new login configuration
*/
+ @Override
public void setLoginConfig(LoginConfig config) {
// Validate the incoming property value
/**
* Get the mapper associated with the context.
*/
+ @Override
public org.apache.tomcat.util.http.mapper.Mapper getMapper() {
return (mapper);
}
/**
* Return the naming resources associated with this web application.
*/
+ @Override
public NamingResources getNamingResources() {
if (namingResources == null) {
*
* @param namingResources The new naming resources
*/
+ @Override
public void setNamingResources(NamingResources namingResources) {
// Process the property setting change
/**
* Return the context path for this Context.
*/
+ @Override
public String getPath() {
return (getName());
*
* @param path The new context path
*/
+ @Override
public void setPath(String path) {
setName(path);
* Return the public identifier of the deployment descriptor DTD that is
* currently being parsed.
*/
+ @Override
public String getPublicId() {
return (this.publicId);
*
* @param publicId The public identifier
*/
+ @Override
public void setPublicId(String publicId) {
if (log.isDebugEnabled())
/**
* Return the reloadable flag for this web application.
*/
+ @Override
public boolean getReloadable() {
return (this.reloadable);
/**
* Return the default context override flag for this web application.
*/
+ @Override
public boolean getOverride() {
return (this.override);
/**
* Return the privileged flag for this web application.
*/
+ @Override
public boolean getPrivileged() {
return (this.privileged);
*
* @param privileged The new privileged flag
*/
+ @Override
public void setPrivileged(boolean privileged) {
boolean oldPrivileged = this.privileged;
*
* @param reloadable The new reloadable flag
*/
+ @Override
public void setReloadable(boolean reloadable) {
boolean oldReloadable = this.reloadable;
*
* @param override The new override flag
*/
+ @Override
public void setOverride(boolean override) {
boolean oldOverride = this.override;
/**
* Return the servlet context for which this Context is a facade.
*/
+ @Override
public ServletContext getServletContext() {
if (context == null) {
* Return the default session timeout (in minutes) for this
* web application.
*/
+ @Override
public int getSessionTimeout() {
return (this.sessionTimeout);
*
* @param timeout The new default session timeout
*/
+ @Override
public void setSessionTimeout(int timeout) {
int oldSessionTimeout = this.sessionTimeout;
/**
* Return the value of the swallowOutput flag.
*/
+ @Override
public boolean getSwallowOutput() {
return (this.swallowOutput);
*
* @param swallowOutput The new value
*/
+ @Override
public void setSwallowOutput(boolean swallowOutput) {
boolean oldSwallowOutput = this.swallowOutput;
* Return the Java class name of the Wrapper implementation used
* for servlets registered in this Context.
*/
+ @Override
public String getWrapperClass() {
return (this.wrapperClassName);
* @throws IllegalArgumentException if the specified wrapper class
* cannot be found or is not a subclass of StandardWrapper
*/
+ @Override
public void setWrapperClass(String wrapperClassName) {
this.wrapperClassName = wrapperClassName;
}
+ @Override
public JspConfigDescriptor getJspConfigDescriptor() {
return jspConfigDescriptor;
}
*
* @param listener Java class name of a listener class
*/
+ @Override
public void addApplicationListener(String listener) {
synchronized (applicationListenersLock) {
*
* @param parameter The new application parameter
*/
+ @Override
public void addApplicationParameter(ApplicationParameter parameter) {
synchronized (applicationParametersLock) {
/**
* Add a security constraint to the set for this web application.
*/
+ @Override
public void addConstraint(SecurityConstraint constraint) {
// Validate the proposed constraint
*
* @param errorPage The error page definition to be added
*/
+ @Override
public void addErrorPage(ErrorPage errorPage) {
// Validate the input parameters
if (errorPage == null)
*
* @param filterDef The filter definition to be added
*/
+ @Override
public void addFilterDef(FilterDef filterDef) {
synchronized (filterDefs) {
* does not match an existing filter definition, or the filter mapping
* is malformed
*/
+ @Override
public void addFilterMap(FilterMap filterMap) {
validateFilterMap(filterMap);
// Add this filter mapping to our registered set
* does not match an existing filter definition, or the filter mapping
* is malformed
*/
+ @Override
public void addFilterMapBefore(FilterMap filterMap) {
validateFilterMap(filterMap);
// Add this filter mapping to our registered set
*
* @param listener Java class name of an InstanceListener class
*/
+ @Override
public void addInstanceListener(String listener) {
synchronized (instanceListenersLock) {
* @param locale locale to map an encoding for
* @param encoding encoding to be used for a give locale
*/
+ @Override
public void addLocaleEncodingMappingParameter(String locale, String encoding){
getCharsetMapper().addCharsetMappingFromDeploymentDescriptor(locale, encoding);
}
* @param extension Filename extension being mapped
* @param mimeType Corresponding MIME type
*/
+ @Override
public void addMimeMapping(String extension, String mimeType) {
synchronized (mimeMappings) {
* or if this context initialization parameter has already been
* registered
*/
+ @Override
public void addParameter(String name, String value) {
// Validate the proposed context initialization parameter
if ((name == null) || (value == null))
* @param role Security role used in the application
* @param link Actual security role to check for
*/
+ @Override
public void addRoleMapping(String role, String link) {
synchronized (roleMappings) {
*
* @param role New security role
*/
+ @Override
public void addSecurityRole(String role) {
synchronized (securityRolesLock) {
* @exception IllegalArgumentException if the specified servlet name
* is not known to this Context
*/
+ @Override
public void addServletMapping(String pattern, String name) {
addServletMapping(pattern, name, false);
}
* @exception IllegalArgumentException if the specified servlet name
* is not known to this Context
*/
+ @Override
public void addServletMapping(String pattern, String name,
boolean jspWildCard) {
// Validate the proposed mapping
*
* @param name New watched resource file name
*/
+ @Override
public void addWatchedResource(String name) {
synchronized (watchedResourcesLock) {
*
* @param name New welcome file name
*/
+ @Override
public void addWelcomeFile(String name) {
synchronized (welcomeFilesLock) {
*
* @param listener Java class name of a LifecycleListener class
*/
+ @Override
public void addWrapperLifecycle(String listener) {
synchronized (wrapperLifecyclesLock) {
*
* @param listener Java class name of a ContainerListener class
*/
+ @Override
public void addWrapperListener(String listener) {
synchronized (wrapperListenersLock) {
* implementation. The constructor of the instantiated Wrapper
* will have been called, but no properties will have been set.
*/
+ @Override
public Wrapper createWrapper() {
Wrapper wrapper = null;
* Return the set of application listener class names configured
* for this application.
*/
+ @Override
public String[] findApplicationListeners() {
return (applicationListeners);
/**
* Return the set of application parameters for this application.
*/
+ @Override
public ApplicationParameter[] findApplicationParameters() {
synchronized (applicationParametersLock) {
* Return the security constraints for this web application.
* If there are none, a zero-length array is returned.
*/
+ @Override
public SecurityConstraint[] findConstraints() {
return (constraints);
*
* @param errorCode Error code to look up
*/
+ @Override
public ErrorPage findErrorPage(int errorCode) {
if (errorCode == 200) {
return (okErrorPage);
*
* @param exceptionType Exception type to look up
*/
+ @Override
public ErrorPage findErrorPage(String exceptionType) {
synchronized (exceptionPages) {
* Return the set of defined error pages for all specified error codes
* and exception types.
*/
+ @Override
public ErrorPage[] findErrorPages() {
synchronized(exceptionPages) {
*
* @param filterName Filter name to look up
*/
+ @Override
public FilterDef findFilterDef(String filterName) {
synchronized (filterDefs) {
/**
* Return the set of defined filters for this Context.
*/
+ @Override
public FilterDef[] findFilterDefs() {
synchronized (filterDefs) {
/**
* Return the set of filter mappings for this Context.
*/
+ @Override
public FilterMap[] findFilterMaps() {
return filterMaps.asArray();
}
* Return the set of InstanceListener classes that will be added to
* newly created Wrappers automatically.
*/
+ @Override
public String[] findInstanceListeners() {
synchronized (instanceListenersLock) {
*
* @param extension Extension to map to a MIME type
*/
+ @Override
public String findMimeMapping(String extension) {
return (mimeMappings.get(extension));
* Return the extensions for which MIME mappings are defined. If there
* are none, a zero-length array is returned.
*/
+ @Override
public String[] findMimeMappings() {
synchronized (mimeMappings) {
*
* @param name Name of the parameter to return
*/
+ @Override
public String findParameter(String name) {
synchronized (parameters) {
* for this Context. If no parameters are defined, a zero-length
* array is returned.
*/
+ @Override
public String[] findParameters() {
synchronized (parameters) {
*
* @param role Security role to map
*/
+ @Override
public String findRoleMapping(String role) {
String realRole = null;
*
* @param role Security role to verify
*/
+ @Override
public boolean findSecurityRole(String role) {
synchronized (securityRolesLock) {
* Return the security roles defined for this application. If none
* have been defined, a zero-length array is returned.
*/
+ @Override
public String[] findSecurityRoles() {
synchronized (securityRolesLock) {
*
* @param pattern Pattern for which a mapping is requested
*/
+ @Override
public String findServletMapping(String pattern) {
synchronized (servletMappingsLock) {
* Return the patterns of all defined servlet mappings for this
* Context. If no mappings are defined, a zero-length array is returned.
*/
+ @Override
public String[] findServletMappings() {
synchronized (servletMappingsLock) {
*
* @param status HTTP status code to look up
*/
+ @Override
public String findStatusPage(int status) {
ErrorPage errorPage = statusPages.get(Integer.valueOf(status));
* been specified. If none are specified, a zero-length array
* is returned.
*/
+ @Override
public int[] findStatusPages() {
synchronized (statusPages) {
*
* @param name Welcome file to verify
*/
+ @Override
public boolean findWelcomeFile(String name) {
synchronized (welcomeFilesLock) {
* Return the set of watched resources for this Context. If none are
* defined, a zero length array will be returned.
*/
+ @Override
public String[] findWatchedResources() {
synchronized (watchedResourcesLock) {
return watchedResources;
* Return the set of welcome files defined for this Context. If none are
* defined, a zero-length array is returned.
*/
+ @Override
public String[] findWelcomeFiles() {
synchronized (welcomeFilesLock) {
* Return the set of LifecycleListener classes that will be added to
* newly created Wrappers automatically.
*/
+ @Override
public String[] findWrapperLifecycles() {
synchronized (wrapperLifecyclesLock) {
* Return the set of ContainerListener classes that will be added to
* newly created Wrappers automatically.
*/
+ @Override
public String[] findWrapperListeners() {
synchronized (wrapperListenersLock) {
* @exception IllegalStateException if the <code>reloadable</code>
* property is set to <code>false</code>.
*/
+ @Override
public synchronized void reload() {
// Validate our current component state
*
* @param listener Java class name of the listener to be removed
*/
+ @Override
public void removeApplicationListener(String listener) {
synchronized (applicationListenersLock) {
*
* @param name Name of the application parameter to remove
*/
+ @Override
public void removeApplicationParameter(String name) {
synchronized (applicationParametersLock) {
*
* @param constraint Constraint to be removed
*/
+ @Override
public void removeConstraint(SecurityConstraint constraint) {
synchronized (constraintsLock) {
*
* @param errorPage The error page definition to be removed
*/
+ @Override
public void removeErrorPage(ErrorPage errorPage) {
String exceptionType = errorPage.getExceptionType();
*
* @param filterDef Filter definition to be removed
*/
+ @Override
public void removeFilterDef(FilterDef filterDef) {
synchronized (filterDefs) {
*
* @param filterMap The filter mapping to be removed
*/
+ @Override
public void removeFilterMap(FilterMap filterMap) {
filterMaps.remove(filterMap);
// Inform interested listeners
*
* @param listener Class name of an InstanceListener class to be removed
*/
+ @Override
public void removeInstanceListener(String listener) {
synchronized (instanceListenersLock) {
*
* @param extension Extension to remove the mapping for
*/
+ @Override
public void removeMimeMapping(String extension) {
synchronized (mimeMappings) {
*
* @param name Name of the parameter to remove
*/
+ @Override
public void removeParameter(String name) {
synchronized (parameters) {
*
* @param role Security role (as used in the application) to remove
*/
+ @Override
public void removeRoleMapping(String role) {
synchronized (roleMappings) {
*
* @param role Security role to remove
*/
+ @Override
public void removeSecurityRole(String role) {
synchronized (securityRolesLock) {
*
* @param pattern URL pattern of the mapping to remove
*/
+ @Override
public void removeServletMapping(String pattern) {
String name = null;
*
* @param name Name of the watched resource to be removed
*/
+ @Override
public void removeWatchedResource(String name) {
synchronized (watchedResourcesLock) {
*
* @param name Name of the welcome file to be removed
*/
+ @Override
public void removeWelcomeFile(String name) {
synchronized (welcomeFilesLock) {
*
* @param listener Class name of a LifecycleListener class to be removed
*/
+ @Override
public void removeWrapperLifecycle(String listener) {
*
* @param listener Class name of a ContainerListener class to be removed
*/
+ @Override
public void removeWrapperListener(String listener) {
*
* @param path The path to the desired resource
*/
+ @Override
public String getRealPath(String path) {
if (webappResources instanceof BaseDirContext) {
return ((BaseDirContext) webappResources).getRealPath(path);
/**
* Start this component and implement the requirements
- * of {@link LifecycleBase#startInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* Stop this component and implement the requirements
- * of {@link LifecycleBase#stopInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* Are we processing a version 2.2 deployment descriptor?
*/
+ @Override
public boolean isServlet22() {
if (this.publicId == null)
}
+ @Override
public Set<String> addServletSecurity(
ApplicationServletRegistration registration,
ServletSecurityElement servletSecurityElement) {
/**
* Return the request processing paused flag for this Context.
*/
+ @Override
public boolean getPaused() {
return (this.paused);
/* Remove a JMX notficationListener
* @see javax.management.NotificationEmitter#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
*/
+ @Override
public void removeNotificationListener(NotificationListener listener,
NotificationFilter filter, Object object) throws ListenerNotFoundException {
broadcaster.removeNotificationListener(listener,filter,object);
* @TODO This two events we not send j2ee.state.failed and j2ee.attribute.changed!
* @see javax.management.NotificationBroadcaster#getNotificationInfo()
*/
+ @Override
public MBeanNotificationInfo[] getNotificationInfo() {
// FIXME: i18n
if(notificationInfo == null) {
/* Add a JMX-NotificationListener
* @see javax.management.NotificationBroadcaster#addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
*/
+ @Override
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter, Object object) throws IllegalArgumentException {
broadcaster.addNotificationListener(listener,filter,object);
* Remove a JMX-NotificationListener
* @see javax.management.NotificationBroadcaster#removeNotificationListener(javax.management.NotificationListener)
*/
+ @Override
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
broadcaster.removeNotificationListener(listener);
* parsing xml instances.
* @param webXmlValidation true to enable xml instance validation
*/
+ @Override
public void setXmlValidation(boolean webXmlValidation){
this.webXmlValidation = webXmlValidation;
* @return true if validation is enabled.
*
*/
+ @Override
public boolean getXmlValidation(){
return webXmlValidation;
}
* Get the server.xml <context> attribute's xmlNamespaceAware.
* @return true if namespace awarenes is enabled.
*/
+ @Override
public boolean getXmlNamespaceAware(){
return webXmlNamespaceAware;
}
* parsing xml instances.
* @param webXmlNamespaceAware true to enable namespace awareness
*/
+ @Override
public void setXmlNamespaceAware(boolean webXmlNamespaceAware){
this.webXmlNamespaceAware= webXmlNamespaceAware;
}
* parsing tlds files.
* @param tldValidation true to enable xml instance validation
*/
+ @Override
public void setTldValidation(boolean tldValidation){
this.tldValidation = tldValidation;
* @return true if validation is enabled.
*
*/
+ @Override
public boolean getTldValidation(){
return tldValidation;
}
* Get the server.xml <host> attribute's xmlNamespaceAware.
* @return true if namespace awarenes is enabled.
*/
+ @Override
public boolean getTldNamespaceAware(){
return tldNamespaceAware;
}
* parsing xml instances.
* @param tldNamespaceAware true to enable namespace awareness
*/
+ @Override
public void setTldNamespaceAware(boolean tldNamespaceAware){
this.tldNamespaceAware= tldNamespaceAware;
}