Package org.apache.jasper.servlet
Class JspCServletContext
java.lang.Object
org.apache.jasper.servlet.JspCServletContext
- All Implemented Interfaces:
ServletContext
Simple
ServletContext implementation without
HTTP-specific methods.- Author:
- Peter Rossbach (pr@webapp.de)
-
Field Summary
Fields inherited from interface javax.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 TypeMethodDescriptionvoidaddListener(Class<? extends EventListener> listenerClass) voidaddListener(String className) <T extends EventListener>
voidaddListener(T t) addServlet(String servletName, Class<? extends Servlet> servletClass) addServlet(String servletName, String className) addServlet(String servletName, Servlet servlet) <T extends Filter>
TcreateFilter(Class<T> c) <T extends EventListener>
TcreateListener(Class<T> c) <T extends 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.getContext(String uripath) Return the servlet context for the specified path.Return the context path.intintgetFilterRegistration(String filterName) Map<String,? extends FilterRegistration> getInitParameter(String name) Return the specified context initialization parameter.Return an enumeration of the names of context initialization parameters.intReturn the Servlet API major version number.getMimeType(String file) Return the MIME type for the specified filename.intReturn the Servlet API minor version number.getNamedDispatcher(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.getRequestDispatcher(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.getServlet(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 replacementgetServletRegistration(String servletName) Map<String,? extends ServletRegistration> Deprecated.This method has been deprecated with no replacementvoidDeprecated.Use log(String,Throwable) insteadvoidLog 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) voidsetSessionTrackingModes(Set<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 interfaceServletContext- Parameters:
name- Name of the requested attribute
-
getAttributeNames
Return an enumeration of context attribute names.- Specified by:
getAttributeNamesin interfaceServletContext
-
getContext
Return the servlet context for the specified path.- Specified by:
getContextin interfaceServletContext- Parameters:
uripath- Server-relative path starting with '/'
-
getContextPath
Return the context path.- Specified by:
getContextPathin interfaceServletContext
-
getInitParameter
Return the specified context initialization parameter.- Specified by:
getInitParameterin interfaceServletContext- Parameters:
name- Name of the requested parameter
-
getInitParameterNames
Return an enumeration of the names of context initialization parameters.- Specified by:
getInitParameterNamesin interfaceServletContext
-
getMajorVersion
public int getMajorVersion()Return the Servlet API major version number.- Specified by:
getMajorVersionin interfaceServletContext
-
getMimeType
Return the MIME type for the specified filename.- Specified by:
getMimeTypein interfaceServletContext- Parameters:
file- Filename whose MIME type is requested
-
getMinorVersion
public int getMinorVersion()Return the Servlet API minor version number.- Specified by:
getMinorVersionin interfaceServletContext
-
getNamedDispatcher
Return a request dispatcher for the specified servlet name.- Specified by:
getNamedDispatcherin interfaceServletContext- Parameters:
name- Name of the requested servlet
-
getRealPath
Return the real path for the specified context-relative virtual path.- Specified by:
getRealPathin interfaceServletContext- Parameters:
path- The context-relative virtual path to resolve
-
getRequestDispatcher
Return a request dispatcher for the specified context-relative path.- Specified by:
getRequestDispatcherin interfaceServletContext- 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 interfaceServletContext- 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 interfaceServletContext- 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 interfaceServletContext- Parameters:
path- Context-relative base path
-
getServerInfo
Return descriptive information about this server.- Specified by:
getServerInfoin interfaceServletContext
-
getServlet
Deprecated.This method has been deprecated with no replacementReturn a null reference for the specified servlet name.- Specified by:
getServletin interfaceServletContext- Parameters:
name- Name of the requested servlet- Throws:
ServletException
-
getServletContextName
Return the name of this servlet context.- Specified by:
getServletContextNamein interfaceServletContext
-
getServletNames
Deprecated.This method has been deprecated with no replacementReturn an empty enumeration of servlet names.- Specified by:
getServletNamesin interfaceServletContext
-
getServlets
Deprecated.This method has been deprecated with no replacementReturn an empty enumeration of servlets.- Specified by:
getServletsin interfaceServletContext
-
log
Log the specified message.- Specified by:
login interfaceServletContext- Parameters:
message- The message to be logged
-
log
Deprecated.Use log(String,Throwable) insteadLog the specified message and exception.- Specified by:
login interfaceServletContext- Parameters:
exception- The exception to be loggedmessage- The message to be logged
-
log
Log the specified message and exception.- Specified by:
login interfaceServletContext- Parameters:
message- The message to be loggedexception- The exception to be logged
-
removeAttribute
Remove the specified context attribute.- Specified by:
removeAttributein interfaceServletContext- Parameters:
name- Name of the attribute to remove
-
setAttribute
Set or replace the specified context attribute.- Specified by:
setAttributein interfaceServletContext- Parameters:
name- Name of the context attribute to setvalue- Corresponding attribute value
-
addFilter
- Specified by:
addFilterin interfaceServletContext
-
addServlet
- Specified by:
addServletin interfaceServletContext
-
getDefaultSessionTrackingModes
- Specified by:
getDefaultSessionTrackingModesin interfaceServletContext
-
getEffectiveSessionTrackingModes
- Specified by:
getEffectiveSessionTrackingModesin interfaceServletContext
-
getSessionCookieConfig
- Specified by:
getSessionCookieConfigin interfaceServletContext
-
setSessionTrackingModes
- Specified by:
setSessionTrackingModesin interfaceServletContext
-
addFilter
- Specified by:
addFilterin interfaceServletContext
-
addFilter
- Specified by:
addFilterin interfaceServletContext
-
addServlet
- Specified by:
addServletin interfaceServletContext
-
addServlet
public ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass) - Specified by:
addServletin interfaceServletContext
-
createFilter
- Specified by:
createFilterin interfaceServletContext- Throws:
ServletException
-
createServlet
- Specified by:
createServletin interfaceServletContext- Throws:
ServletException
-
getFilterRegistration
- Specified by:
getFilterRegistrationin interfaceServletContext
-
getServletRegistration
- Specified by:
getServletRegistrationin interfaceServletContext
-
setInitParameter
- Specified by:
setInitParameterin interfaceServletContext
-
addListener
- Specified by:
addListenerin interfaceServletContext
-
addListener
- Specified by:
addListenerin interfaceServletContext
-
addListener
- Specified by:
addListenerin interfaceServletContext
-
createListener
- Specified by:
createListenerin interfaceServletContext- Throws:
ServletException
-
declareRoles
- Specified by:
declareRolesin interfaceServletContext
-
getClassLoader
- Specified by:
getClassLoaderin interfaceServletContext
-
getEffectiveMajorVersion
public int getEffectiveMajorVersion()- Specified by:
getEffectiveMajorVersionin interfaceServletContext
-
getEffectiveMinorVersion
public int getEffectiveMinorVersion()- Specified by:
getEffectiveMinorVersionin interfaceServletContext
-
getFilterRegistrations
- Specified by:
getFilterRegistrationsin interfaceServletContext
-
getJspConfigDescriptor
- Specified by:
getJspConfigDescriptorin interfaceServletContext
-
getServletRegistrations
- Specified by:
getServletRegistrationsin interfaceServletContext
-
getVirtualServerName
- Specified by:
getVirtualServerNamein interfaceServletContext
-