Class JspCServletContext
java.lang.Object
org.apache.jasper.servlet.JspCServletContext
- All Implemented Interfaces:
javax.servlet.ServletContext
Simple
ServletContext implementation without
HTTP-specific methods.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javax.servlet.descriptor.JspConfigDescriptorServlet context attributes.protected PrintWriterThe log writer we will write log messages to.protected URLThe base URL (document root) for this context.private static final StringFields inherited from interface javax.servlet.ServletContext
ORDERED_LIBS, TEMPDIR -
Constructor Summary
ConstructorsConstructorDescriptionJspCServletContext(PrintWriter aLogWriter, URL aResourceBaseURL) Create a new instance of this ServletContext implementation. -
Method Summary
Modifier and TypeMethodDescriptionjavax.servlet.FilterRegistration.Dynamicjavax.servlet.FilterRegistration.DynamicvoidaddFilter(String filterName, String description, String className, Map<String, String> initParameters) Adds the filter with the given name, description, and class name to this servlet context.javax.servlet.FilterRegistration.Dynamicjavax.servlet.ServletRegistration.DynamicaddJspFile(String servletName, String jspFile) voidaddListener(Class<? extends EventListener> listenerClass) voidaddListener(String className) <T extends EventListener>
voidaddListener(T t) javax.servlet.ServletRegistration.DynamicaddServlet(String servletName, Class<? extends javax.servlet.Servlet> servletClass) javax.servlet.ServletRegistration.DynamicaddServlet(String servletName, String className) voidaddServlet(String servletName, String description, String className, Map<String, String> initParameters, int loadOnStartup) javax.servlet.ServletRegistration.DynamicaddServlet(String servletName, javax.servlet.Servlet servlet) voidaddServletMapping(String servletName, String[] urlPatterns) Adds servlet mappings from the given url patterns to the servlet with the given servlet name to this servlet context.<T extends javax.servlet.Filter>
TcreateFilter(Class<T> c) <T extends EventListener>
TcreateListener(Class<T> clazz) <T extends javax.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.javax.servlet.ServletContextgetContext(String uripath) Return the servlet context for the specified path.Returns the context path of the web application.Set<javax.servlet.SessionTrackingMode> intintSet<javax.servlet.SessionTrackingMode> javax.servlet.FilterRegistrationgetFilterRegistration(String filterName) getInitParameter(String name) Return the specified context initialization parameter.Return an enumeration of the names of context initialization parameters.javax.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.javax.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.javax.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.javax.servlet.ServletgetServlet(String name) Deprecated.This method has been deprecated with no replacementReturn the name of this servlet context.Deprecated.This method has been deprecated with no replacementjavax.servlet.ServletRegistrationgetServletRegistration(String servletName) Enumeration<javax.servlet.Servlet> Deprecated.This method has been deprecated with no replacementjavax.servlet.SessionCookieConfigintvoidDeprecated.Use log(String,Throwable) insteadvoidLog the specified message.voidLog the specified message and exception.private voidvoidremoveAttribute(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 charset) voidsetResponseCharacterEncoding(String charset) voidsetSessionTimeout(int sessionTimeout) voidsetSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> sessionTrackingModes)
-
Field Details
-
myAttributes
-
myLogWriter
The log writer we will write log messages to. -
myResourceBaseURL
The base URL (document root) for this context. -
jspConfigDescriptor
private javax.servlet.descriptor.JspConfigDescriptor jspConfigDescriptor -
WEB_XML
- See Also:
-
-
Constructor Details
-
JspCServletContext
Create a new instance of this ServletContext implementation.- Parameters:
aLogWriter- PrintWriter which is used forlog()callsaResourceBaseURL- Resource base URL
-
-
Method Details
-
getAttribute
-
getAttributeNames
Return an enumeration of context attribute names.- Specified by:
getAttributeNamesin interfacejavax.servlet.ServletContext
-
getContextPath
Returns the context path of the web application.- Specified by:
getContextPathin interfacejavax.servlet.ServletContext
-
getContext
Return the servlet context for the specified path.- Specified by:
getContextin interfacejavax.servlet.ServletContext- Parameters:
uripath- Server-relative path starting with '/'
-
getInitParameter
-
getInitParameterNames
Return an enumeration of the names of context initialization parameters.- Specified by:
getInitParameterNamesin interfacejavax.servlet.ServletContext
-
getMajorVersion
public int getMajorVersion()Return the Servlet API major version number.- Specified by:
getMajorVersionin interfacejavax.servlet.ServletContext
-
getMimeType
-
getMinorVersion
public int getMinorVersion()Return the Servlet API minor version number.- Specified by:
getMinorVersionin interfacejavax.servlet.ServletContext
-
getEffectiveMajorVersion
public int getEffectiveMajorVersion()- Specified by:
getEffectiveMajorVersionin interfacejavax.servlet.ServletContext
-
getEffectiveMinorVersion
public int getEffectiveMinorVersion()- Specified by:
getEffectiveMinorVersionin interfacejavax.servlet.ServletContext
-
getNamedDispatcher
Return a request dispatcher for the specified servlet name.- Specified by:
getNamedDispatcherin interfacejavax.servlet.ServletContext- Parameters:
name- Name of the requested servlet
-
getRealPath
-
getRequestDispatcher
Return a request dispatcher for the specified context-relative path.- Specified by:
getRequestDispatcherin interfacejavax.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 interfacejavax.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 interfacejavax.servlet.ServletContext- Parameters:
path- Context-relative path of the desired resource
-
getResourcePaths
-
getServerInfo
Return descriptive information about this server.- Specified by:
getServerInfoin interfacejavax.servlet.ServletContext
-
getServlet
Deprecated.This method has been deprecated with no replacementReturn a null reference for the specified servlet name.- Specified by:
getServletin interfacejavax.servlet.ServletContext- Parameters:
name- Name of the requested servlet- Throws:
javax.servlet.ServletException
-
getServletContextName
Return the name of this servlet context.- Specified by:
getServletContextNamein interfacejavax.servlet.ServletContext
-
getServletNames
Deprecated.This method has been deprecated with no replacementReturn an empty enumeration of servlet names.- Specified by:
getServletNamesin interfacejavax.servlet.ServletContext
-
getServlets
Deprecated.This method has been deprecated with no replacementReturn an empty enumeration of servlets.- Specified by:
getServletsin interfacejavax.servlet.ServletContext
-
log
Log the specified message.- Specified by:
login interfacejavax.servlet.ServletContext- Parameters:
message- The message to be logged
-
log
-
log
-
removeAttribute
Remove the specified context attribute.- Specified by:
removeAttributein interfacejavax.servlet.ServletContext- Parameters:
name- Name of the attribute to remove
-
setAttribute
-
addServlet
-
addServletMapping
-
addFilter
-
setInitParameter
-
addServlet
-
addServlet
public javax.servlet.ServletRegistration.Dynamic addServlet(String servletName, javax.servlet.Servlet servlet) - Specified by:
addServletin interfacejavax.servlet.ServletContext
-
addServlet
-
createServlet
public <T extends javax.servlet.Servlet> T createServlet(Class<T> c) throws javax.servlet.ServletException - Specified by:
createServletin interfacejavax.servlet.ServletContext- Throws:
javax.servlet.ServletException
-
getServletRegistration
- Specified by:
getServletRegistrationin interfacejavax.servlet.ServletContext
-
getServletRegistrations
-
addFilter
-
addFilter
public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, javax.servlet.Filter filter) - Specified by:
addFilterin interfacejavax.servlet.ServletContext
-
addFilter
-
createFilter
- Specified by:
createFilterin interfacejavax.servlet.ServletContext
-
getFilterRegistration
- Specified by:
getFilterRegistrationin interfacejavax.servlet.ServletContext
-
getFilterRegistrations
-
getSessionCookieConfig
public javax.servlet.SessionCookieConfig getSessionCookieConfig()- Specified by:
getSessionCookieConfigin interfacejavax.servlet.ServletContext
-
setSessionTrackingModes
- Specified by:
setSessionTrackingModesin interfacejavax.servlet.ServletContext
-
getDefaultSessionTrackingModes
- Specified by:
getDefaultSessionTrackingModesin interfacejavax.servlet.ServletContext
-
getEffectiveSessionTrackingModes
- Specified by:
getEffectiveSessionTrackingModesin interfacejavax.servlet.ServletContext
-
addListener
- Specified by:
addListenerin interfacejavax.servlet.ServletContext
-
addListener
- Specified by:
addListenerin interfacejavax.servlet.ServletContext
-
addListener
- Specified by:
addListenerin interfacejavax.servlet.ServletContext
-
createListener
public <T extends EventListener> T createListener(Class<T> clazz) throws javax.servlet.ServletException - Specified by:
createListenerin interfacejavax.servlet.ServletContext- Throws:
javax.servlet.ServletException
-
getJspConfigDescriptor
public javax.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()- Specified by:
getJspConfigDescriptorin interfacejavax.servlet.ServletContext
-
getClassLoader
- Specified by:
getClassLoaderin interfacejavax.servlet.ServletContext
-
declareRoles
- Specified by:
declareRolesin interfacejavax.servlet.ServletContext
-
parseWebDotXml
private void parseWebDotXml() -
getVirtualServerName
- Specified by:
getVirtualServerNamein interfacejavax.servlet.ServletContext
-
setResponseCharacterEncoding
- Specified by:
setResponseCharacterEncodingin interfacejavax.servlet.ServletContext
-
getResponseCharacterEncoding
- Specified by:
getResponseCharacterEncodingin interfacejavax.servlet.ServletContext
-
setRequestCharacterEncoding
- Specified by:
setRequestCharacterEncodingin interfacejavax.servlet.ServletContext
-
getRequestCharacterEncoding
- Specified by:
getRequestCharacterEncodingin interfacejavax.servlet.ServletContext
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout) - Specified by:
setSessionTimeoutin interfacejavax.servlet.ServletContext
-
getSessionTimeout
public int getSessionTimeout()- Specified by:
getSessionTimeoutin interfacejavax.servlet.ServletContext
-
addJspFile
-