Top Description Inners Fields Constructors Methods
org.apache.catalina.core

public Class ApplicationContextFacade

extends Object
implements ServletContext
Class Inheritance
All Implemented Interfaces
jakarta.servlet.ServletContext
Imports
java.io.InputStream, java.lang.reflect.InvocationTargetException, .Method, java.net.MalformedURLException, .URL, java.security.AccessController, .PrivilegedActionException, .PrivilegedExceptionAction, java.util.Enumeration, .EventListener, .HashMap, .Map, .Set, java.util.concurrent.ConcurrentHashMap, jakarta.servlet.Filter, .FilterRegistration, .RequestDispatcher, .Servlet, .ServletContext, .ServletException, .ServletRegistration, .ServletRegistration.Dynamic, .SessionCookieConfig, .SessionTrackingMode, jakarta.servlet.descriptor.JspConfigDescriptor, org.apache.catalina.Globals, org.apache.catalina.security.SecurityUtil, org.apache.tomcat.util.ExceptionUtils

Facade object which masks the internal ApplicationContext object from the web application.
Author
Remy Maucherat

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Map<String, Class<?>[]>
classCache

Cache Class object used for reflection.

private final ApplicationContext
context

Wrapped application context.

private final Map<String, Method>
objectCache

Cache method object.

Constructor Summary

AccessConstructor and Description
public
ApplicationContextFacade(ApplicationContext
The associated Context instance
context
)

Construct a new instance of this class, associated with the specified Context instance.

Method Summary

Modifier and TypeMethod and Description
public FilterRegistration.Dynamic
addFilter(String
Name of filter to add
filterName
,
String
Name of filter class
className
)

Implements jakarta.servlet.ServletContext.addFilter.

Add filter to context.

public FilterRegistration.Dynamic
addFilter(String
Name of filter to add
filterName
,
Filter
Filter to add
filter
)

Implements jakarta.servlet.ServletContext.addFilter.

Add filter to context.

public FilterRegistration.Dynamic
addFilter(String
Name of filter to add
filterName
,
Class<? extends Filter>
Class of filter to add
filterClass
)

Implements jakarta.servlet.ServletContext.addFilter.

Add filter to context.

public ServletRegistration.Dynamic
addJspFile(String
The servlet name under which this JSP file should be registered
jspName
,
String
The path, relative to the web application root, for the JSP file to be used for this servlet
jspFile
)

Implements jakarta.servlet.ServletContext.addJspFile.

Add a JSP to the context.

public void
addListener(Class<? extends EventListener>
TODO
listenerClass
)

Implements jakarta.servlet.ServletContext.addListener, jakarta.servlet.ServletContext.addListener.

TODO SERVLET3 - Add comments

public void
public <T extends EventListener> void
addListener(T
TODO
t
)

Implements jakarta.servlet.ServletContext.addListener.

TODO SERVLET3 - Add comments

public ServletRegistration.Dynamic
addServlet(String
The name of the servlet to register
servletName
,
String
The implementation class for the servlet
className
)

Implements jakarta.servlet.ServletContext.addServlet.

Register a servlet implementation for use in this ServletContext.

public ServletRegistration.Dynamic
addServlet(String
The name of the servlet to register
servletName
,
Servlet
The Servlet instance to register
servlet
)

Implements jakarta.servlet.ServletContext.addServlet.

Register a servlet instance for use in this ServletContext.

public ServletRegistration.Dynamic
addServlet(String
Name of servlet to add
servletName
,
Class<? extends Servlet>
Class of servlet to add
servletClass
)

Implements jakarta.servlet.ServletContext.addServlet.

Add servlet to the context.

public <T extends Filter> T
createFilter(Class<T>
The the class for which an instance should be created
c
)

Implements jakarta.servlet.ServletContext.createFilter.

Create a Filter instance using the given class.

public <T extends EventListener> T
createListener(Class<T>
TODO
c
)

Implements jakarta.servlet.ServletContext.createListener.

TODO SERVLET3 - Add comments

public <T extends Servlet> T
createServlet(Class<T>
The the class for which an instance should be created
c
)

Implements jakarta.servlet.ServletContext.createServlet.

Create an Servlet instance using the given class.

public void
declareRoles(String...
The roles to add
roleNames
)

Implements jakarta.servlet.ServletContext.declareRoles.

Add to the declared roles for this ServletContext.

private Object
doPrivileged(final String
The method to call.
methodName
,
final Object[]
The arguments passed to the called method.
params
)

Use reflection to invoke the requested method.

private Object
doPrivileged(final String
The method to invoke.
methodName
,
final Class<?>[]
The class where the method is.
clazz
,
Object[]
The arguments passed to the called method.
params
)

Use reflection to invoke the requested method.

private Object
executeMethod(final Method
The method object to be invoked.
method
,
final ApplicationContext
The ApplicationContext object on which the method will be invoked
context
,
final Object[]
The arguments passed to the called method.
params
)

Executes the method of the specified ApplicationContext

public Object
getAttribute(String
a String specifying the name of the attribute
name
)

Implements jakarta.servlet.ServletContext.getAttribute.

Returns the servlet container attribute with the given name, or null if there is no attribute by that name.

public Enumeration<String>
getAttributeNames()

Implements jakarta.servlet.ServletContext.getAttributeNames.

Returns an Enumeration containing the attribute names available within this servlet context.

public ClassLoader
getClassLoader()

Implements jakarta.servlet.ServletContext.getClassLoader.

Get the web application class loader associated with this ServletContext.

public ServletContext
getContext(String
a String specifying the context path of another web application in the container.
uripath
)

Implements jakarta.servlet.ServletContext.getContext.

Returns a ServletContext object that corresponds to a specified URL on the server.

public String
getContextPath()

Implements jakarta.servlet.ServletContext.getContextPath.

Return the main path associated with this context.

public Set<SessionTrackingMode>
getDefaultSessionTrackingModes()

Implements jakarta.servlet.ServletContext.getDefaultSessionTrackingModes.

Obtains the default session tracking modes for this web application.

public int
getEffectiveMajorVersion()

Implements jakarta.servlet.ServletContext.getEffectiveMajorVersion.

Obtain the major version of the servlet specification for which this web application is implemented.

public int
getEffectiveMinorVersion()

Implements jakarta.servlet.ServletContext.getEffectiveMinorVersion.

Obtain the minor version of the servlet specification for which this web application is implemented.

public Set<SessionTrackingMode>
getEffectiveSessionTrackingModes()

Implements jakarta.servlet.ServletContext.getEffectiveSessionTrackingModes.

Obtains the currently enabled session tracking modes for this web application.

public FilterRegistration
getFilterRegistration(String
TODO
filterName
)

Implements jakarta.servlet.ServletContext.getFilterRegistration.

TODO SERVLET3 - Add comments

public Map<String, ? extends FilterRegistration>
public String
getInitParameter(String
a String containing the name of the parameter whose value is requested
name
)

Implements jakarta.servlet.ServletContext.getInitParameter.

Returns a String containing the value of the named context-wide initialization parameter, or null if the parameter does not exist.

public Enumeration<String>
getInitParameterNames()

Implements jakarta.servlet.ServletContext.getInitParameterNames.

Returns the names of the context's initialization parameters as an Enumeration of String objects, or an empty Enumeration if the context has no initialization parameters.

public JspConfigDescriptor
public int
getMajorVersion()

Implements jakarta.servlet.ServletContext.getMajorVersion.

Returns the major version of the Java Servlet API that this servlet container supports.

public String
getMimeType(String
a String specifying the name of a file
file
)

Implements jakarta.servlet.ServletContext.getMimeType.

Returns the MIME type of the specified file, or null if the MIME type is not known.

public int
getMinorVersion()

Implements jakarta.servlet.ServletContext.getMinorVersion.

Returns the minor version of the Servlet API that this servlet container supports.

public RequestDispatcher
getNamedDispatcher(String
a String specifying the name of a servlet to wrap
name
)

Implements jakarta.servlet.ServletContext.getNamedDispatcher.

Returns a RequestDispatcher object that acts as a wrapper for the named servlet.

public String
getRealPath(String
a String specifying a virtual path
path
)

Implements jakarta.servlet.ServletContext.getRealPath.

Returns a String containing the real path for a given virtual path.

public String
getRequestCharacterEncoding()

Implements jakarta.servlet.ServletContext.getRequestCharacterEncoding.

Get the default character encoding for reading request bodies.

public RequestDispatcher
getRequestDispatcher(final String
a String specifying the pathname to the resource
path
)

Implements jakarta.servlet.ServletContext.getRequestDispatcher.

Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path.

public URL
getResource(String
a String specifying the path to the resource
path
)

Implements jakarta.servlet.ServletContext.getResource.

Returns a URL to the resource that is mapped to a specified path.

public InputStream
getResourceAsStream(String
a String specifying the path to the resource
path
)

Implements jakarta.servlet.ServletContext.getResourceAsStream.

Returns the resource located at the named path as an InputStream object.

public Set<String>
getResourcePaths(String
the partial path used to match the resources, which must start with a /
path
)

Implements jakarta.servlet.ServletContext.getResourcePaths.

Returns a directory-like listing of all the paths to resources within the web application whose longest sub-path matches the supplied path argument.

public String
getResponseCharacterEncoding()

Implements jakarta.servlet.ServletContext.getResponseCharacterEncoding.

Get the default character encoding for writing response bodies.

public String
getServerInfo()

Implements jakarta.servlet.ServletContext.getServerInfo.

Returns the name and version of the servlet container on which the servlet is running.

public String
getServletContextName()

Implements jakarta.servlet.ServletContext.getServletContextName.

Returns the name of this web application corresponding to this ServletContext as specified in the deployment descriptor for this web application by the display-name element.

public ServletRegistration
getServletRegistration(String
The name of the Servlet of interest
servletName
)

Implements jakarta.servlet.ServletContext.getServletRegistration.

Obtain the details of the named servlet.

public Map<String, ? extends ServletRegistration>
getServletRegistrations()

Implements jakarta.servlet.ServletContext.getServletRegistrations.

Obtain a Map of servlet names to servlet registrations for all servlets registered with this context.

public SessionCookieConfig
public int
getSessionTimeout()

Implements jakarta.servlet.ServletContext.getSessionTimeout.

Get the default session timeout.

public String
getVirtualServerName()

Implements jakarta.servlet.ServletContext.getVirtualServerName.

Get the primary name of the virtual host on which this context is deployed.

private void
handleException(Exception
The current exception
ex
)

Throw the real exception.

private void
private Object
invokeMethod(ApplicationContext
The ApplicationContext object on which the method will be invoked
appContext
,
final String
The method to call.
methodName
,
Object[]
The arguments passed to the called method.
params
)

Use reflection to invoke the requested method.

public void
log(String
a String specifying the message to be written to the log file
msg
)

Implements jakarta.servlet.ServletContext.log.

Writes the specified message to a servlet log file, usually an event log.

public void
log(String
a String that describes the error or exception
message
,
Throwable
the Throwable error or exception
throwable
)

Implements jakarta.servlet.ServletContext.log.

Writes an explanatory message and a stack trace for a given Throwable exception to the servlet log file.

public void
removeAttribute(String
a String specifying the name of the attribute to be removed
name
)

Implements jakarta.servlet.ServletContext.removeAttribute.

Removes the attribute with the given name from the servlet context.

public void
setAttribute(String
a String specifying the name of the attribute
name
,
Object
an Object representing the attribute to be bound
object
)

Implements jakarta.servlet.ServletContext.setAttribute.

Binds an object to a given attribute name in this servlet context.

public boolean
setInitParameter(String
Name of initialisation parameter
name
,
String
Value for initialisation parameter
value
)

Implements jakarta.servlet.ServletContext.setInitParameter.

Set the given initialisation parameter to the given value.

public void
setRequestCharacterEncoding(String
The name of the character encoding to use
encoding
)

Implements jakarta.servlet.ServletContext.setRequestCharacterEncoding.

Set the default character encoding to use for reading request bodies.

public void
setResponseCharacterEncoding(String
The name of the character encoding to use
encoding
)

Implements jakarta.servlet.ServletContext.setResponseCharacterEncoding.

Set the default character encoding to use for writing response bodies.

public void
setSessionTimeout(int
The new default session timeout in minutes.
sessionTimeout
)

Implements jakarta.servlet.ServletContext.setSessionTimeout.

Set the default session timeout.

public void
setSessionTrackingModes(Set<SessionTrackingMode>
The session tracking modes to use for this web application
sessionTrackingModes
)

Implements jakarta.servlet.ServletContext.setSessionTrackingModes.

Configures the available session tracking modes for this web application.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait