Package org.apache.catalina.core
Class ApplicationContextFacade
- java.lang.Object
-
- org.apache.catalina.core.ApplicationContextFacade
-
- All Implemented Interfaces:
jakarta.servlet.ServletContext
public final class ApplicationContextFacade extends Object implements jakarta.servlet.ServletContext
Facade object which masks the internalApplicationContextobject from the web application.- Version:
- $Revision: 1.7.6.1 $ $Date: 2008/04/17 18:37:06 $
- Author:
- Remy Maucherat, Jean-Francois Arcand
-
-
Constructor Summary
Constructors Constructor Description ApplicationContextFacade(ApplicationContext context)Construct a new instance of this class, associated with the specified Context instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.servlet.FilterRegistration.DynamicaddFilter(String filterName, jakarta.servlet.Filter filter)jakarta.servlet.FilterRegistration.DynamicaddFilter(String filterName, Class<? extends jakarta.servlet.Filter> filterClass)Adds the filter with the given name and class type to this servlet context.jakarta.servlet.FilterRegistration.DynamicaddFilter(String filterName, String className)Adds the filter with the given name and class name to this servlet context.jakarta.servlet.ServletRegistration.DynamicaddJspFile(String servletName, String jspFile)voidaddListener(Class<? extends EventListener> listenerClass)Adds a listener of the given class type to this ServletContext.voidaddListener(String className)Adds the listener with the given class name to this ServletContext.<T extends EventListener>
voidaddListener(T t)Adds the given listener to this ServletContext.jakarta.servlet.ServletRegistration.DynamicaddServlet(String servletName, jakarta.servlet.Servlet servlet)jakarta.servlet.ServletRegistration.DynamicaddServlet(String servletName, Class<? extends jakarta.servlet.Servlet> servletClass)jakarta.servlet.ServletRegistration.DynamicaddServlet(String servletName, String className)<T extends jakarta.servlet.Filter>
TcreateFilter(Class<T> clazz)Instantiates the given Filter class and performs any required resource injection into the new Filter instance before returning it.<T extends EventListener>
TcreateListener(Class<T> clazz)Instantiates the given EventListener class and performs any required resource injection into the new EventListener instance before returning it.<T extends jakarta.servlet.Servlet>
TcreateServlet(Class<T> clazz)Instantiates the given Servlet class and performs any required resource injection into the new Servlet instance before returning it.voiddeclareRoles(String... roleNames)ObjectgetAttribute(String name)Enumeration<String>getAttributeNames()ClassLoadergetClassLoader()jakarta.servlet.ServletContextgetContext(String uripath)StringgetContextPath()Set<jakarta.servlet.SessionTrackingMode>getDefaultSessionTrackingModes()Gets the session tracking modes that are supported by default for this ServletContext.intgetEffectiveMajorVersion()Gets the major version of the Servlet specification that the application represented by this ServletContext is based on.intgetEffectiveMinorVersion()Gets the minor version of the Servlet specification that the application represented by this ServletContext is based on.Set<jakarta.servlet.SessionTrackingMode>getEffectiveSessionTrackingModes()Gets the session tracking modes that are in effect for this ServletContext.jakarta.servlet.FilterRegistrationgetFilterRegistration(String filterName)Gets the FilterRegistration corresponding to the filter with the given filterName.Map<String,? extends jakarta.servlet.FilterRegistration>getFilterRegistrations()Gets a Map of the FilterRegistration objects corresponding to all currently registered filters.StringgetInitParameter(String name)Enumeration<String>getInitParameterNames()jakarta.servlet.descriptor.JspConfigDescriptorgetJspConfigDescriptor()Gets the<jsp-config>related configuration that was aggregated from theweb.xmlandweb-fragment.xmldescriptor files of the web application represented by this ServletContext.intgetMajorVersion()StringgetMimeType(String file)intgetMinorVersion()jakarta.servlet.RequestDispatchergetNamedDispatcher(String name)StringgetRealPath(String path)StringgetRequestCharacterEncoding()jakarta.servlet.RequestDispatchergetRequestDispatcher(String path)URLgetResource(String path)InputStreamgetResourceAsStream(String path)Set<String>getResourcePaths(String path)StringgetResponseCharacterEncoding()StringgetServerInfo()StringgetServletContextName()jakarta.servlet.ServletRegistrationgetServletRegistration(String servletName)Gets the ServletRegistration corresponding to the servlet with the given servletName.Map<String,? extends jakarta.servlet.ServletRegistration>getServletRegistrations()Gets a Map of the ServletRegistration objects corresponding to all currently registered servlets.jakarta.servlet.SessionCookieConfiggetSessionCookieConfig()Gets the SessionCookieConfig object through which various properties of the session tracking cookies created on behalf of this ServletContext may be configured.intgetSessionTimeout()StringgetVirtualServerName()voidlog(String msg)voidlog(String message, Throwable throwable)voidremoveAttribute(String name)voidsetAttribute(String name, Object object)booleansetInitParameter(String name, String value)voidsetRequestCharacterEncoding(String encoding)voidsetResponseCharacterEncoding(String encoding)voidsetSessionTimeout(int sessionTimeout)voidsetSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)Sets the session tracking modes that are to become effective for this ServletContext.
-
-
-
Constructor Detail
-
ApplicationContextFacade
public ApplicationContextFacade(ApplicationContext context)
Construct a new instance of this class, associated with the specified Context instance.- Parameters:
context- The associated Context instance
-
-
Method Detail
-
getContextPath
public String getContextPath()
- Specified by:
getContextPathin interfacejakarta.servlet.ServletContext
-
getContext
public jakarta.servlet.ServletContext getContext(String uripath)
- Specified by:
getContextin interfacejakarta.servlet.ServletContext
-
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersionin interfacejakarta.servlet.ServletContext
-
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersionin interfacejakarta.servlet.ServletContext
-
getEffectiveMajorVersion
public int getEffectiveMajorVersion()
Gets the major version of the Servlet specification that the application represented by this ServletContext is based on.- Specified by:
getEffectiveMajorVersionin interfacejakarta.servlet.ServletContext
-
getEffectiveMinorVersion
public int getEffectiveMinorVersion()
Gets the minor version of the Servlet specification that the application represented by this ServletContext is based on.- Specified by:
getEffectiveMinorVersionin interfacejakarta.servlet.ServletContext
-
getMimeType
public String getMimeType(String file)
- Specified by:
getMimeTypein interfacejakarta.servlet.ServletContext
-
getResourcePaths
public Set<String> getResourcePaths(String path)
- Specified by:
getResourcePathsin interfacejakarta.servlet.ServletContext
-
getResource
public URL getResource(String path) throws MalformedURLException
- Specified by:
getResourcein interfacejakarta.servlet.ServletContext- Throws:
MalformedURLException
-
getResourceAsStream
public InputStream getResourceAsStream(String path)
- Specified by:
getResourceAsStreamin interfacejakarta.servlet.ServletContext
-
getRequestDispatcher
public jakarta.servlet.RequestDispatcher getRequestDispatcher(String path)
- Specified by:
getRequestDispatcherin interfacejakarta.servlet.ServletContext
-
getNamedDispatcher
public jakarta.servlet.RequestDispatcher getNamedDispatcher(String name)
- Specified by:
getNamedDispatcherin interfacejakarta.servlet.ServletContext
-
log
public void log(String msg)
- Specified by:
login interfacejakarta.servlet.ServletContext
-
log
public void log(String message, Throwable throwable)
- Specified by:
login interfacejakarta.servlet.ServletContext
-
getRealPath
public String getRealPath(String path)
- Specified by:
getRealPathin interfacejakarta.servlet.ServletContext
-
getServerInfo
public String getServerInfo()
- Specified by:
getServerInfoin interfacejakarta.servlet.ServletContext
-
getInitParameter
public String getInitParameter(String name)
- Specified by:
getInitParameterin interfacejakarta.servlet.ServletContext
-
getInitParameterNames
public Enumeration<String> getInitParameterNames()
- Specified by:
getInitParameterNamesin interfacejakarta.servlet.ServletContext
-
setInitParameter
public boolean setInitParameter(String name, String value)
- Specified by:
setInitParameterin interfacejakarta.servlet.ServletContext- Returns:
- true if the context initialization parameter with the given name and value was set successfully on this ServletContext, and false if it was not set because this ServletContext already contains a context initialization parameter with a matching name
-
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttributein interfacejakarta.servlet.ServletContext
-
getAttributeNames
public Enumeration<String> getAttributeNames()
- Specified by:
getAttributeNamesin interfacejakarta.servlet.ServletContext
-
setAttribute
public void setAttribute(String name, Object object)
- Specified by:
setAttributein interfacejakarta.servlet.ServletContext
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttributein interfacejakarta.servlet.ServletContext
-
getServletContextName
public String getServletContextName()
- Specified by:
getServletContextNamein interfacejakarta.servlet.ServletContext
-
addServlet
public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, String className)
- Specified by:
addServletin interfacejakarta.servlet.ServletContext
-
addServlet
public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, jakarta.servlet.Servlet servlet)
- Specified by:
addServletin interfacejakarta.servlet.ServletContext
-
addServlet
public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, Class<? extends jakarta.servlet.Servlet> servletClass)
- Specified by:
addServletin interfacejakarta.servlet.ServletContext
-
addJspFile
public jakarta.servlet.ServletRegistration.Dynamic addJspFile(String servletName, String jspFile)
- Specified by:
addJspFilein interfacejakarta.servlet.ServletContext
-
createServlet
public <T extends jakarta.servlet.Servlet> T createServlet(Class<T> clazz) throws jakarta.servlet.ServletException
Instantiates the given Servlet class and performs any required resource injection into the new Servlet instance before returning it.- Specified by:
createServletin interfacejakarta.servlet.ServletContext- Throws:
jakarta.servlet.ServletException
-
getServletRegistration
public jakarta.servlet.ServletRegistration getServletRegistration(String servletName)
Gets the ServletRegistration corresponding to the servlet with the given servletName.- Specified by:
getServletRegistrationin interfacejakarta.servlet.ServletContext
-
getServletRegistrations
public Map<String,? extends jakarta.servlet.ServletRegistration> getServletRegistrations()
Gets a Map of the ServletRegistration objects corresponding to all currently registered servlets.- Specified by:
getServletRegistrationsin interfacejakarta.servlet.ServletContext
-
addFilter
public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, String className)
Adds the filter with the given name and class name to this servlet context.- Specified by:
addFilterin interfacejakarta.servlet.ServletContext
-
addFilter
public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, jakarta.servlet.Filter filter)
- Specified by:
addFilterin interfacejakarta.servlet.ServletContext
-
addFilter
public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, Class<? extends jakarta.servlet.Filter> filterClass)
Adds the filter with the given name and class type to this servlet context.- Specified by:
addFilterin interfacejakarta.servlet.ServletContext
-
createFilter
public <T extends jakarta.servlet.Filter> T createFilter(Class<T> clazz) throws jakarta.servlet.ServletException
Instantiates the given Filter class and performs any required resource injection into the new Filter instance before returning it.- Specified by:
createFilterin interfacejakarta.servlet.ServletContext- Throws:
jakarta.servlet.ServletException
-
getFilterRegistration
public jakarta.servlet.FilterRegistration getFilterRegistration(String filterName)
Gets the FilterRegistration corresponding to the filter with the given filterName.- Specified by:
getFilterRegistrationin interfacejakarta.servlet.ServletContext
-
getFilterRegistrations
public Map<String,? extends jakarta.servlet.FilterRegistration> getFilterRegistrations()
Gets a Map of the FilterRegistration objects corresponding to all currently registered filters.- Specified by:
getFilterRegistrationsin interfacejakarta.servlet.ServletContext
-
getSessionCookieConfig
public jakarta.servlet.SessionCookieConfig getSessionCookieConfig()
Gets the SessionCookieConfig object through which various properties of the session tracking cookies created on behalf of this ServletContext may be configured.- Specified by:
getSessionCookieConfigin interfacejakarta.servlet.ServletContext
-
setSessionTrackingModes
public void setSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)
Sets the session tracking modes that are to become effective for this ServletContext.- Specified by:
setSessionTrackingModesin interfacejakarta.servlet.ServletContext
-
getDefaultSessionTrackingModes
public Set<jakarta.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
Gets the session tracking modes that are supported by default for this ServletContext.- Specified by:
getDefaultSessionTrackingModesin interfacejakarta.servlet.ServletContext- Returns:
- set of the session tracking modes supported by default for this ServletContext
-
getEffectiveSessionTrackingModes
public Set<jakarta.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
Gets the session tracking modes that are in effect for this ServletContext.- Specified by:
getEffectiveSessionTrackingModesin interfacejakarta.servlet.ServletContext- Returns:
- set of the session tracking modes in effect for this ServletContext
-
addListener
public void addListener(String className)
Adds the listener with the given class name to this ServletContext.- Specified by:
addListenerin interfacejakarta.servlet.ServletContext
-
addListener
public <T extends EventListener> void addListener(T t)
Adds the given listener to this ServletContext.- Specified by:
addListenerin interfacejakarta.servlet.ServletContext
-
addListener
public void addListener(Class<? extends EventListener> listenerClass)
Adds a listener of the given class type to this ServletContext.- Specified by:
addListenerin interfacejakarta.servlet.ServletContext
-
createListener
public <T extends EventListener> T createListener(Class<T> clazz) throws jakarta.servlet.ServletException
Instantiates the given EventListener class and performs any required resource injection into the new EventListener instance before returning it.- Specified by:
createListenerin interfacejakarta.servlet.ServletContext- Throws:
jakarta.servlet.ServletException
-
getJspConfigDescriptor
public jakarta.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()
Gets the<jsp-config>related configuration that was aggregated from theweb.xmlandweb-fragment.xmldescriptor files of the web application represented by this ServletContext.- Specified by:
getJspConfigDescriptorin interfacejakarta.servlet.ServletContext
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoaderin interfacejakarta.servlet.ServletContext
-
declareRoles
public void declareRoles(String... roleNames)
- Specified by:
declareRolesin interfacejakarta.servlet.ServletContext
-
getVirtualServerName
public String getVirtualServerName()
- Specified by:
getVirtualServerNamein interfacejakarta.servlet.ServletContext
-
getSessionTimeout
public int getSessionTimeout()
- Specified by:
getSessionTimeoutin interfacejakarta.servlet.ServletContext
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout)
- Specified by:
setSessionTimeoutin interfacejakarta.servlet.ServletContext
-
getRequestCharacterEncoding
public String getRequestCharacterEncoding()
- Specified by:
getRequestCharacterEncodingin interfacejakarta.servlet.ServletContext
-
setRequestCharacterEncoding
public void setRequestCharacterEncoding(String encoding)
- Specified by:
setRequestCharacterEncodingin interfacejakarta.servlet.ServletContext
-
getResponseCharacterEncoding
public String getResponseCharacterEncoding()
- Specified by:
getResponseCharacterEncodingin interfacejakarta.servlet.ServletContext
-
setResponseCharacterEncoding
public void setResponseCharacterEncoding(String encoding)
- Specified by:
setResponseCharacterEncodingin interfacejakarta.servlet.ServletContext
-
-