public class JspCServletContext extends Object
ServletContext implementation without
HTTP-specific methods.| Constructor and Description |
|---|
JspCServletContext(PrintWriter aLogWriter,
URL aResourceBaseURL,
ClassLoader classLoader,
boolean validate,
boolean blockExternal)
Create a new instance of this ServletContext implementation.
|
| Modifier and Type | Method and Description |
|---|---|
Dynamic |
addFilter(String filterName,
Class<? extends Filter> filterClass) |
Dynamic |
addFilter(String filterName,
Filter filter) |
FilterRegistration.Dynamic |
addFilter(String filterName,
String className) |
void |
addListener(Class<? extends EventListener> listenerClass) |
void |
addListener(String className) |
<T extends EventListener> |
addListener(T t) |
ServletRegistration.Dynamic |
addServlet(String servletName,
Class<? extends Servlet> servletClass) |
ServletRegistration.Dynamic |
addServlet(String servletName,
Servlet servlet) |
ServletRegistration.Dynamic |
addServlet(String servletName,
String className) |
<T extends Filter> |
createFilter(Class<T> c) |
<T extends EventListener> |
createListener(Class<T> c) |
<T extends Servlet> |
createServlet(Class<T> c) |
void |
declareRoles(String... roleNames) |
Object |
getAttribute(String name)
Return the specified context attribute, if any.
|
Enumeration<String> |
getAttributeNames()
Return an enumeration of context attribute names.
|
ClassLoader |
getClassLoader() |
ServletContext |
getContext(String uripath)
Return the servlet context for the specified path.
|
String |
getContextPath()
Return the context path.
|
Set<SessionTrackingMode> |
getDefaultSessionTrackingModes() |
int |
getEffectiveMajorVersion() |
int |
getEffectiveMinorVersion() |
Set<SessionTrackingMode> |
getEffectiveSessionTrackingModes() |
FilterRegistration |
getFilterRegistration(String filterName) |
Map<String,? extends FilterRegistration> |
getFilterRegistrations() |
String |
getInitParameter(String name)
Return the specified context initialization parameter.
|
Enumeration<String> |
getInitParameterNames()
Return an enumeration of the names of context initialization
parameters.
|
JspConfigDescriptor |
getJspConfigDescriptor() |
int |
getMajorVersion()
Return the Servlet API major version number.
|
String |
getMimeType(String file)
Return the MIME type for the specified filename.
|
int |
getMinorVersion()
Return the Servlet API minor version number.
|
RequestDispatcher |
getNamedDispatcher(String name)
Return a request dispatcher for the specified servlet name.
|
String |
getRealPath(String path)
Return the real path for the specified context-relative
virtual path.
|
RequestDispatcher |
getRequestDispatcher(String path)
Return a request dispatcher for the specified context-relative path.
|
URL |
getResource(String path)
Return a URL object of a resource that is mapped to the
specified context-relative path.
|
InputStream |
getResourceAsStream(String path)
Return an InputStream allowing access to the resource at the
specified context-relative path.
|
Set<String> |
getResourcePaths(String path)
Return the set of resource paths for the "directory" at the
specified context path.
|
String |
getServerInfo()
Return descriptive information about this server.
|
Servlet |
getServlet(String name)
Deprecated.
This method has been deprecated with no replacement
|
String |
getServletContextName()
Return the name of this servlet context.
|
Enumeration<String> |
getServletNames()
Deprecated.
This method has been deprecated with no replacement
|
ServletRegistration |
getServletRegistration(String servletName) |
Map<String,? extends ServletRegistration> |
getServletRegistrations() |
Enumeration<Servlet> |
getServlets()
Deprecated.
This method has been deprecated with no replacement
|
SessionCookieConfig |
getSessionCookieConfig() |
String |
getVirtualServerName() |
void |
log(Exception exception,
String message)
Deprecated.
Use log(String,Throwable) instead
|
void |
log(String message)
Log the specified message.
|
void |
log(String message,
Throwable exception)
Log the specified message and exception.
|
void |
removeAttribute(String name)
Remove the specified context attribute.
|
void |
setAttribute(String name,
Object value)
Set or replace the specified context attribute.
|
boolean |
setInitParameter(String name,
String value) |
void |
setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) |
public JspCServletContext(PrintWriter aLogWriter, URL aResourceBaseURL, ClassLoader classLoader, boolean validate, boolean blockExternal) throws JasperException
aLogWriter - PrintWriter which is used for log() callsaResourceBaseURL - Resource base URLclassLoader - Class loader for this ServletContextvalidate - Should a validating parser be used to parse web.xml?blockExternal - Should external entities be blocked when parsing
web.xml?JasperExceptionpublic Object getAttribute(String name)
name - Name of the requested attributepublic Enumeration<String> getAttributeNames()
public ServletContext getContext(String uripath)
uripath - Server-relative path starting with '/'public String getContextPath()
public String getInitParameter(String name)
name - Name of the requested parameterpublic Enumeration<String> getInitParameterNames()
public int getMajorVersion()
public String getMimeType(String file)
file - Filename whose MIME type is requestedpublic int getMinorVersion()
public RequestDispatcher getNamedDispatcher(String name)
name - Name of the requested servletpublic String getRealPath(String path)
path - The context-relative virtual path to resolvepublic RequestDispatcher getRequestDispatcher(String path)
path - Context-relative path for which to acquire a dispatcherpublic URL getResource(String path) throws MalformedURLException
path - Context-relative path of the desired resourceMalformedURLException - if the resource path is
not properly formedpublic InputStream getResourceAsStream(String path)
path - Context-relative path of the desired resourcepublic Set<String> getResourcePaths(String path)
path - Context-relative base pathpublic String getServerInfo()
@Deprecated public Servlet getServlet(String name) throws ServletException
name - Name of the requested servletServletExceptionpublic String getServletContextName()
@Deprecated public Enumeration<String> getServletNames()
@Deprecated public Enumeration<Servlet> getServlets()
public void log(String message)
message - The message to be logged@Deprecated public void log(Exception exception, String message)
exception - The exception to be loggedmessage - The message to be loggedpublic void log(String message, Throwable exception)
message - The message to be loggedexception - The exception to be loggedpublic void removeAttribute(String name)
name - Name of the attribute to removepublic void setAttribute(String name, Object value)
name - Name of the context attribute to setvalue - Corresponding attribute valuepublic Set<SessionTrackingMode> getDefaultSessionTrackingModes()
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
public SessionCookieConfig getSessionCookieConfig()
public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes)
public Dynamic addFilter(String filterName, Filter filter)
public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet)
public ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass)
public <T extends Filter> T createFilter(Class<T> c) throws ServletException
ServletExceptionpublic <T extends Servlet> T createServlet(Class<T> c) throws ServletException
ServletExceptionpublic FilterRegistration getFilterRegistration(String filterName)
public ServletRegistration getServletRegistration(String servletName)
public void addListener(Class<? extends EventListener> listenerClass)
public void addListener(String className)
public <T extends EventListener> void addListener(T t)
public <T extends EventListener> T createListener(Class<T> c) throws ServletException
ServletExceptionpublic void declareRoles(String... roleNames)
public ClassLoader getClassLoader()
public int getEffectiveMajorVersion()
public int getEffectiveMinorVersion()
public JspConfigDescriptor getJspConfigDescriptor()
public String getVirtualServerName()
Copyright © 2014 Mort Bay Consulting. All Rights Reserved.