Package org.apache.jasper.servlet
Class JspCServletContext
java.lang.Object
org.apache.jasper.servlet.JspCServletContext
- All Implemented Interfaces:
jakarta.servlet.ServletContext
Simple
ServletContext implementation without
HTTP-specific methods.- Author:
- Peter Rossbach (pr@webapp.de)
-
Field Summary
Fields inherited from interface jakarta.servlet.ServletContext
ORDERED_LIBS, TEMPDIR -
Constructor Summary
ConstructorsConstructorDescriptionJspCServletContext(PrintWriter aLogWriter, URL aResourceBaseURL, ClassLoader classLoader, boolean validate, boolean blockExternal) Create a new instance of this ServletContext implementation. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.servlet.FilterRegistration.Dynamicjakarta.servlet.FilterRegistration.Dynamicjakarta.servlet.FilterRegistration.Dynamicjakarta.servlet.ServletRegistration.DynamicaddJspFile(String jspName, String jspFile) voidaddListener(Class<? extends EventListener> listenerClass) voidaddListener(String className) <T extends EventListener>
voidaddListener(T t) 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> c) <T extends EventListener>
TcreateListener(Class<T> c) <T extends jakarta.servlet.Servlet>
TcreateServlet(Class<T> c) voiddeclareRoles(String... roleNames) getAttribute(String name) Return the specified context attribute, if any.Return an enumeration of context attribute names.jakarta.servlet.ServletContextgetContext(String uripath) Return the servlet context for the specified path.Return the context path.Set<jakarta.servlet.SessionTrackingMode>intintSet<jakarta.servlet.SessionTrackingMode>jakarta.servlet.FilterRegistrationgetFilterRegistration(String filterName) getInitParameter(String name) Return the specified context initialization parameter.Return an enumeration of the names of context initialization parameters.jakarta.servlet.descriptor.JspConfigDescriptorintReturn the Servlet API major version number.getMimeType(String file) Return the MIME type for the specified filename.intReturn the Servlet API minor version number.jakarta.servlet.RequestDispatchergetNamedDispatcher(String name) Return a request dispatcher for the specified servlet name.getRealPath(String path) Return the real path for the specified context-relative virtual path.jakarta.servlet.RequestDispatchergetRequestDispatcher(String path) Return a request dispatcher for the specified context-relative path.getResource(String path) Return a URL object of a resource that is mapped to the specified context-relative path.getResourceAsStream(String path) Return an InputStream allowing access to the resource at the specified context-relative path.getResourcePaths(String path) Return the set of resource paths for the "directory" at the specified context path.Return descriptive information about this server.Return the name of this servlet context.jakarta.servlet.ServletRegistrationgetServletRegistration(String servletName) jakarta.servlet.SessionCookieConfigintvoidLog the specified message.voidLog the specified message and exception.voidremoveAttribute(String name) Remove the specified context attribute.voidsetAttribute(String name, Object value) Set or replace the specified context attribute.booleansetInitParameter(String name, String value) voidsetRequestCharacterEncoding(String encoding) voidsetResponseCharacterEncoding(String encoding) voidsetSessionTimeout(int sessionTimeout) voidsetSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)
-
Constructor Details
-
JspCServletContext
public JspCServletContext(PrintWriter aLogWriter, URL aResourceBaseURL, ClassLoader classLoader, boolean validate, boolean blockExternal) throws JasperException Create a new instance of this ServletContext implementation.- Parameters:
aLogWriter- PrintWriter which is used forlog()callsaResourceBaseURL- Resource base URLclassLoader- Class loader for thisServletContextvalidate- Should a validating parser be used to parse web.xml?blockExternal- Should external entities be blocked when parsing web.xml?- Throws:
JasperException- An error occurred building the merged web.xml
-
-
Method Details
-
getAttribute
Return the specified context attribute, if any.- Specified by:
getAttributein interfacejakarta.servlet.ServletContext- Parameters:
name- Name of the requested attribute
-
getAttributeNames
Return an enumeration of context attribute names.- Specified by:
getAttributeNamesin interfacejakarta.servlet.ServletContext
-
getContext
Return the servlet context for the specified path.- Specified by:
getContextin interfacejakarta.servlet.ServletContext- Parameters:
uripath- Server-relative path starting with '/'
-
getContextPath
Return the context path.- Specified by:
getContextPathin interfacejakarta.servlet.ServletContext
-
getInitParameter
Return the specified context initialization parameter.- Specified by:
getInitParameterin interfacejakarta.servlet.ServletContext- Parameters:
name- Name of the requested parameter
-
getInitParameterNames
Return an enumeration of the names of context initialization parameters.- Specified by:
getInitParameterNamesin interfacejakarta.servlet.ServletContext
-
getMajorVersion
public int getMajorVersion()Return the Servlet API major version number.- Specified by:
getMajorVersionin interfacejakarta.servlet.ServletContext
-
getMimeType
Return the MIME type for the specified filename.- Specified by:
getMimeTypein interfacejakarta.servlet.ServletContext- Parameters:
file- Filename whose MIME type is requested
-
getMinorVersion
public int getMinorVersion()Return the Servlet API minor version number.- Specified by:
getMinorVersionin interfacejakarta.servlet.ServletContext
-
getNamedDispatcher
Return a request dispatcher for the specified servlet name.- Specified by:
getNamedDispatcherin interfacejakarta.servlet.ServletContext- Parameters:
name- Name of the requested servlet
-
getRealPath
Return the real path for the specified context-relative virtual path.- Specified by:
getRealPathin interfacejakarta.servlet.ServletContext- Parameters:
path- The context-relative virtual path to resolve
-
getRequestDispatcher
Return a request dispatcher for the specified context-relative path.- Specified by:
getRequestDispatcherin interfacejakarta.servlet.ServletContext- Parameters:
path- Context-relative path for which to acquire a dispatcher
-
getResource
Return a URL object of a resource that is mapped to the specified context-relative path.- Specified by:
getResourcein interfacejakarta.servlet.ServletContext- Parameters:
path- Context-relative path of the desired resource- Throws:
MalformedURLException- if the resource path is not properly formed
-
getResourceAsStream
Return an InputStream allowing access to the resource at the specified context-relative path.- Specified by:
getResourceAsStreamin interfacejakarta.servlet.ServletContext- Parameters:
path- Context-relative path of the desired resource
-
getResourcePaths
Return the set of resource paths for the "directory" at the specified context path.- Specified by:
getResourcePathsin interfacejakarta.servlet.ServletContext- Parameters:
path- Context-relative base path
-
getServerInfo
Return descriptive information about this server.- Specified by:
getServerInfoin interfacejakarta.servlet.ServletContext
-
getServletContextName
Return the name of this servlet context.- Specified by:
getServletContextNamein interfacejakarta.servlet.ServletContext
-
log
Log the specified message.- Specified by:
login interfacejakarta.servlet.ServletContext- Parameters:
message- The message to be logged
-
log
Log the specified message and exception.- Specified by:
login interfacejakarta.servlet.ServletContext- Parameters:
message- The message to be loggedexception- The exception to be logged
-
removeAttribute
Remove the specified context attribute.- Specified by:
removeAttributein interfacejakarta.servlet.ServletContext- Parameters:
name- Name of the attribute to remove
-
setAttribute
Set or replace the specified context attribute.- Specified by:
setAttributein interfacejakarta.servlet.ServletContext- Parameters:
name- Name of the context attribute to setvalue- Corresponding attribute value
-
addFilter
- Specified by:
addFilterin interfacejakarta.servlet.ServletContext
-
addServlet
- Specified by:
addServletin interfacejakarta.servlet.ServletContext
-
getDefaultSessionTrackingModes
- Specified by:
getDefaultSessionTrackingModesin interfacejakarta.servlet.ServletContext
-
getEffectiveSessionTrackingModes
- Specified by:
getEffectiveSessionTrackingModesin interfacejakarta.servlet.ServletContext
-
getSessionCookieConfig
public jakarta.servlet.SessionCookieConfig getSessionCookieConfig()- Specified by:
getSessionCookieConfigin interfacejakarta.servlet.ServletContext
-
setSessionTrackingModes
- Specified by:
setSessionTrackingModesin 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) - Specified by:
addFilterin 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
- Specified by:
addJspFilein interfacejakarta.servlet.ServletContext
-
createFilter
public <T extends jakarta.servlet.Filter> T createFilter(Class<T> c) throws jakarta.servlet.ServletException - Specified by:
createFilterin interfacejakarta.servlet.ServletContext- Throws:
jakarta.servlet.ServletException
-
createServlet
public <T extends jakarta.servlet.Servlet> T createServlet(Class<T> c) throws jakarta.servlet.ServletException - Specified by:
createServletin interfacejakarta.servlet.ServletContext- Throws:
jakarta.servlet.ServletException
-
getFilterRegistration
- Specified by:
getFilterRegistrationin interfacejakarta.servlet.ServletContext
-
getServletRegistration
- Specified by:
getServletRegistrationin interfacejakarta.servlet.ServletContext
-
setInitParameter
- Specified by:
setInitParameterin interfacejakarta.servlet.ServletContext
-
addListener
- Specified by:
addListenerin interfacejakarta.servlet.ServletContext
-
addListener
- Specified by:
addListenerin interfacejakarta.servlet.ServletContext
-
addListener
- Specified by:
addListenerin interfacejakarta.servlet.ServletContext
-
createListener
public <T extends EventListener> T createListener(Class<T> c) throws jakarta.servlet.ServletException - Specified by:
createListenerin interfacejakarta.servlet.ServletContext- Throws:
jakarta.servlet.ServletException
-
declareRoles
- Specified by:
declareRolesin interfacejakarta.servlet.ServletContext
-
getClassLoader
- Specified by:
getClassLoaderin interfacejakarta.servlet.ServletContext
-
getEffectiveMajorVersion
public int getEffectiveMajorVersion()- Specified by:
getEffectiveMajorVersionin interfacejakarta.servlet.ServletContext
-
getEffectiveMinorVersion
public int getEffectiveMinorVersion()- Specified by:
getEffectiveMinorVersionin interfacejakarta.servlet.ServletContext
-
getFilterRegistrations
- Specified by:
getFilterRegistrationsin interfacejakarta.servlet.ServletContext
-
getJspConfigDescriptor
public jakarta.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()- Specified by:
getJspConfigDescriptorin interfacejakarta.servlet.ServletContext
-
getServletRegistrations
- Specified by:
getServletRegistrationsin interfacejakarta.servlet.ServletContext
-
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
- Specified by:
getRequestCharacterEncodingin interfacejakarta.servlet.ServletContext
-
setRequestCharacterEncoding
- Specified by:
setRequestCharacterEncodingin interfacejakarta.servlet.ServletContext
-
getResponseCharacterEncoding
- Specified by:
getResponseCharacterEncodingin interfacejakarta.servlet.ServletContext
-
setResponseCharacterEncoding
- Specified by:
setResponseCharacterEncodingin interfacejakarta.servlet.ServletContext
-