public class JspCServletContext extends java.lang.Object implements ServletContext
ServletContext implementation without
HTTP-specific methods.ORDERED_LIBS, TEMPDIR| Constructor and Description |
|---|
JspCServletContext(java.io.PrintWriter aLogWriter,
java.net.URL aResourceBaseURL,
java.lang.ClassLoader classLoader,
boolean validate,
boolean blockExternal)
Create a new instance of this ServletContext implementation.
|
| Modifier and Type | Method and Description |
|---|---|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
java.lang.Class<? extends Filter> filterClass)
Add filter to context.
|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
Filter filter)
Add filter to context.
|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
java.lang.String className)
Add filter to context.
|
ServletRegistration.Dynamic |
addJspFile(java.lang.String jspName,
java.lang.String jspFile) |
void |
addListener(java.lang.Class<? extends java.util.EventListener> listenerClass)
TODO SERVLET3 - Add comments
|
void |
addListener(java.lang.String className)
TODO SERVLET3 - Add comments
|
<T extends java.util.EventListener> |
addListener(T t)
TODO SERVLET3 - Add comments
|
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
java.lang.Class<? extends Servlet> servletClass)
Add servlet to context.
|
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
Servlet servlet)
Register a servlet instance for use in this ServletContext.
|
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
java.lang.String className)
Register a servlet implementation for use in this ServletContext.
|
<T extends Filter> |
createFilter(java.lang.Class<T> c)
TODO SERVLET3 - Add comments
|
<T extends java.util.EventListener> |
createListener(java.lang.Class<T> c)
TODO SERVLET3 - Add comments
|
<T extends Servlet> |
createServlet(java.lang.Class<T> c)
TODO SERVLET3 - Add comments
|
void |
declareRoles(java.lang.String... roleNames)
Add to the declared roles for this ServletContext.
|
java.lang.Object |
getAttribute(java.lang.String name)
Return the specified context attribute, if any.
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Return an enumeration of context attribute names.
|
java.lang.ClassLoader |
getClassLoader()
Get the web application class loader associated with this ServletContext.
|
ServletContext |
getContext(java.lang.String uripath)
Return the servlet context for the specified path.
|
java.lang.String |
getContextPath()
Return the context path.
|
java.util.Set<SessionTrackingMode> |
getDefaultSessionTrackingModes()
Obtains the default session tracking modes for this web application.
|
int |
getEffectiveMajorVersion() |
int |
getEffectiveMinorVersion() |
java.util.Set<SessionTrackingMode> |
getEffectiveSessionTrackingModes()
Obtains the currently enabled session tracking modes for this web
application.
|
FilterRegistration |
getFilterRegistration(java.lang.String filterName)
TODO SERVLET3 - Add comments
|
java.util.Map<java.lang.String,? extends FilterRegistration> |
getFilterRegistrations() |
java.lang.String |
getInitParameter(java.lang.String name)
Return the specified context initialization parameter.
|
java.util.Enumeration<java.lang.String> |
getInitParameterNames()
Return an enumeration of the names of context initialization
parameters.
|
JspConfigDescriptor |
getJspConfigDescriptor() |
int |
getMajorVersion()
Return the Servlet API major version number.
|
java.lang.String |
getMimeType(java.lang.String file)
Return the MIME type for the specified filename.
|
int |
getMinorVersion()
Return the Servlet API minor version number.
|
RequestDispatcher |
getNamedDispatcher(java.lang.String name)
Return a request dispatcher for the specified servlet name.
|
java.lang.String |
getRealPath(java.lang.String path)
Return the real path for the specified context-relative
virtual path.
|
java.lang.String |
getRequestCharacterEncoding()
Get the default character encoding for reading request bodies.
|
RequestDispatcher |
getRequestDispatcher(java.lang.String path)
Return a request dispatcher for the specified context-relative path.
|
java.net.URL |
getResource(java.lang.String path)
Return a URL object of a resource that is mapped to the
specified context-relative path.
|
java.io.InputStream |
getResourceAsStream(java.lang.String path)
Return an InputStream allowing access to the resource at the
specified context-relative path.
|
java.util.Set<java.lang.String> |
getResourcePaths(java.lang.String path)
Return the set of resource paths for the "directory" at the
specified context path.
|
java.lang.String |
getResponseCharacterEncoding()
Get the default character encoding for writing response bodies.
|
java.lang.String |
getServerInfo()
Return descriptive information about this server.
|
Servlet |
getServlet(java.lang.String name)
Deprecated.
This method has been deprecated with no replacement
|
java.lang.String |
getServletContextName()
Return the name of this servlet context.
|
java.util.Enumeration<java.lang.String> |
getServletNames()
Deprecated.
This method has been deprecated with no replacement
|
ServletRegistration |
getServletRegistration(java.lang.String servletName)
Obtain the details of the named servlet.
|
java.util.Map<java.lang.String,? extends ServletRegistration> |
getServletRegistrations()
TODO SERVLET3 - Add comments
|
java.util.Enumeration<Servlet> |
getServlets()
Deprecated.
This method has been deprecated with no replacement
|
SessionCookieConfig |
getSessionCookieConfig() |
int |
getSessionTimeout()
Get the default session timeout.
|
java.lang.String |
getVirtualServerName()
Get the primary name of the virtual host on which this context is
deployed.
|
void |
log(java.lang.Exception exception,
java.lang.String message)
Deprecated.
Use log(String,Throwable) instead
|
void |
log(java.lang.String message)
Log the specified message.
|
void |
log(java.lang.String message,
java.lang.Throwable exception)
Log the specified message and exception.
|
void |
removeAttribute(java.lang.String name)
Remove the specified context attribute.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set or replace the specified context attribute.
|
boolean |
setInitParameter(java.lang.String name,
java.lang.String value)
Set the given initialisation parameter to the given value.
|
void |
setRequestCharacterEncoding(java.lang.String encoding)
Set the default character encoding to use for reading request bodies.
|
void |
setResponseCharacterEncoding(java.lang.String encoding)
Set the default character encoding to use for writing response bodies.
|
void |
setSessionTimeout(int sessionTimeout)
Set the default session timeout.
|
void |
setSessionTrackingModes(java.util.Set<SessionTrackingMode> sessionTrackingModes)
Configures the available session tracking modes for this web application.
|
public JspCServletContext(java.io.PrintWriter aLogWriter,
java.net.URL aResourceBaseURL,
java.lang.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?JasperException - An error occurred building the merged web.xmlpublic java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface ServletContextname - Name of the requested attributeObject containing the value of the attribute, or
null if no attribute exists matching the given nameServletContext.getAttributeNames()public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames in interface ServletContextEnumeration of attribute namesServletContext.getAttribute(java.lang.String)public ServletContext getContext(java.lang.String uripath)
getContext in interface ServletContexturipath - Server-relative path starting with '/'ServletContext object that corresponds to the
named URL, or null if either none exists or the container wishes
to restrict this access.RequestDispatcherpublic java.lang.String getContextPath()
getContextPath in interface ServletContextpublic java.lang.String getInitParameter(java.lang.String name)
getInitParameter in interface ServletContextname - Name of the requested parameterString containing the value of the initialization
parameterServletConfig.getInitParameter(java.lang.String)public java.util.Enumeration<java.lang.String> getInitParameterNames()
getInitParameterNames in interface ServletContextEnumeration of String objects
containing the names of the context's initialization parametersServletConfig.getInitParameter(java.lang.String)public int getMajorVersion()
getMajorVersion in interface ServletContextpublic java.lang.String getMimeType(java.lang.String file)
getMimeType in interface ServletContextfile - Filename whose MIME type is requestedString specifying the file's MIME typepublic int getMinorVersion()
getMinorVersion in interface ServletContextpublic RequestDispatcher getNamedDispatcher(java.lang.String name)
getNamedDispatcher in interface ServletContextname - Name of the requested servletRequestDispatcher object that acts as a wrapper for
the named servlet, or null if the
ServletContext cannot return a
RequestDispatcherRequestDispatcher,
ServletContext.getContext(java.lang.String),
ServletConfig.getServletName()public java.lang.String getRealPath(java.lang.String path)
getRealPath in interface ServletContextpath - The context-relative virtual path to resolveString specifying the real path, or null if the
translation cannot be performedpublic RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher in interface ServletContextpath - Context-relative path for which to acquire a dispatcherRequestDispatcher object that acts as a wrapper for
the resource at the specified path, or null if the
ServletContext cannot return a
RequestDispatcherRequestDispatcher,
ServletContext.getContext(java.lang.String)public java.net.URL getResource(java.lang.String path)
throws java.net.MalformedURLException
getResource in interface ServletContextpath - Context-relative path of the desired resourcenull if
there is no resource at that pathjava.net.MalformedURLException - if the resource path is
not properly formedpublic java.io.InputStream getResourceAsStream(java.lang.String path)
getResourceAsStream in interface ServletContextpath - Context-relative path of the desired resourceInputStream returned to the servlet, or
null if no resource exists at the specified pathpublic java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)
getResourcePaths in interface ServletContextpath - Context-relative base pathpublic java.lang.String getServerInfo()
getServerInfo in interface ServletContextString containing at least the servlet container
name and version number@Deprecated public Servlet getServlet(java.lang.String name) throws ServletException
getServlet in interface ServletContextname - Name of the requested servletnullServletException - neverpublic java.lang.String getServletContextName()
getServletContextName in interface ServletContext@Deprecated public java.util.Enumeration<java.lang.String> getServletNames()
getServletNames in interface ServletContext@Deprecated public java.util.Enumeration<Servlet> getServlets()
getServlets in interface ServletContextpublic void log(java.lang.String message)
log in interface ServletContextmessage - The message to be logged@Deprecated
public void log(java.lang.Exception exception,
java.lang.String message)
log in interface ServletContextexception - The exception to be loggedmessage - The message to be loggedpublic void log(java.lang.String message,
java.lang.Throwable exception)
log in interface ServletContextmessage - The message to be loggedexception - The exception to be loggedpublic void removeAttribute(java.lang.String name)
removeAttribute in interface ServletContextname - Name of the attribute to removepublic void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface ServletContextname - Name of the context attribute to setvalue - Corresponding attribute valuepublic FilterRegistration.Dynamic addFilter(java.lang.String filterName, java.lang.String className)
javax.servlet.ServletContextaddFilter in interface ServletContextfilterName - Name of filter to addclassName - Name of filter classnull if the filter has already been fully defined,
else a FilterRegistration.Dynamic object
that can be used to further configure the filterpublic ServletRegistration.Dynamic addServlet(java.lang.String servletName, java.lang.String className)
javax.servlet.ServletContextaddServlet in interface ServletContextservletName - The name of the servlet to registerclassName - The implementation class for the servletpublic java.util.Set<SessionTrackingMode> getDefaultSessionTrackingModes()
javax.servlet.ServletContextSessionTrackingMode.URL is always supported, SessionTrackingMode.COOKIE is supported unless the cookies
attribute has been set to false for the context and SessionTrackingMode.SSL is supported if at least one of the connectors
used by this context has the attribute secure set to
true.getDefaultSessionTrackingModes in interface ServletContextpublic java.util.Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
javax.servlet.ServletContextgetEffectiveSessionTrackingModes in interface ServletContextServletContext.setSessionTrackingModes(Set) if
one was previously set, else return the defaultspublic SessionCookieConfig getSessionCookieConfig()
getSessionCookieConfig in interface ServletContextpublic void setSessionTrackingModes(java.util.Set<SessionTrackingMode> sessionTrackingModes)
javax.servlet.ServletContextsetSessionTrackingModes in interface ServletContextsessionTrackingModes - The session tracking modes to use for this
web applicationpublic FilterRegistration.Dynamic addFilter(java.lang.String filterName, Filter filter)
javax.servlet.ServletContextaddFilter in interface ServletContextfilterName - Name of filter to addfilter - Filter to addnull if the filter has already been fully defined,
else a FilterRegistration.Dynamic object
that can be used to further configure the filterpublic FilterRegistration.Dynamic addFilter(java.lang.String filterName, java.lang.Class<? extends Filter> filterClass)
javax.servlet.ServletContextaddFilter in interface ServletContextfilterName - Name of filter to addfilterClass - Class of filter to addnull if the filter has already been fully defined,
else a FilterRegistration.Dynamic object
that can be used to further configure the filterpublic ServletRegistration.Dynamic addServlet(java.lang.String servletName, Servlet servlet)
javax.servlet.ServletContextaddServlet in interface ServletContextservletName - The name of the servlet to registerservlet - The Servlet instance to registerpublic ServletRegistration.Dynamic addServlet(java.lang.String servletName, java.lang.Class<? extends Servlet> servletClass)
javax.servlet.ServletContextaddServlet in interface ServletContextservletName - Name of servlet to addservletClass - Class of servlet to addnull if the servlet has already been fully defined,
else a ServletRegistration.Dynamic object
that can be used to further configure the servletpublic ServletRegistration.Dynamic addJspFile(java.lang.String jspName, java.lang.String jspFile)
addJspFile in interface ServletContextjspName - The servlet name under which this JSP file should be
registeredjspFile - The path, relative to the web application root, for the
JSP file to be used for this servletServletRegistration.Dynamic object
that can be used to further configure the servletpublic <T extends Filter> T createFilter(java.lang.Class<T> c) throws ServletException
javax.servlet.ServletContextcreateFilter in interface ServletContextT - TODOc - TODOServletException - TODOpublic <T extends Servlet> T createServlet(java.lang.Class<T> c) throws ServletException
javax.servlet.ServletContextcreateServlet in interface ServletContextT - TODOc - TODOServletException - TODOpublic FilterRegistration getFilterRegistration(java.lang.String filterName)
javax.servlet.ServletContextgetFilterRegistration in interface ServletContextfilterName - TODOpublic ServletRegistration getServletRegistration(java.lang.String servletName)
javax.servlet.ServletContextgetServletRegistration in interface ServletContextservletName - The name of the Servlet of interestnull if no Servlet has been registered with the
given namepublic boolean setInitParameter(java.lang.String name,
java.lang.String value)
javax.servlet.ServletContextsetInitParameter in interface ServletContextname - Name of initialisation parametervalue - Value for initialisation parametertrue if the call succeeds or false if
the call fails because an initialisation parameter with the same
name has already been setpublic void addListener(java.lang.Class<? extends java.util.EventListener> listenerClass)
javax.servlet.ServletContextaddListener in interface ServletContextlistenerClass - TODOpublic void addListener(java.lang.String className)
javax.servlet.ServletContextaddListener in interface ServletContextclassName - TODOpublic <T extends java.util.EventListener> void addListener(T t)
javax.servlet.ServletContextaddListener in interface ServletContextT - TODOt - TODOpublic <T extends java.util.EventListener> T createListener(java.lang.Class<T> c)
throws ServletException
javax.servlet.ServletContextcreateListener in interface ServletContextT - TODOc - TODOServletException - TODOpublic void declareRoles(java.lang.String... roleNames)
javax.servlet.ServletContextdeclareRoles in interface ServletContextroleNames - The roles to addpublic java.lang.ClassLoader getClassLoader()
javax.servlet.ServletContextgetClassLoader in interface ServletContextpublic int getEffectiveMajorVersion()
getEffectiveMajorVersion in interface ServletContextpublic int getEffectiveMinorVersion()
getEffectiveMinorVersion in interface ServletContextpublic java.util.Map<java.lang.String,? extends FilterRegistration> getFilterRegistrations()
getFilterRegistrations in interface ServletContextpublic JspConfigDescriptor getJspConfigDescriptor()
getJspConfigDescriptor in interface ServletContextpublic java.util.Map<java.lang.String,? extends ServletRegistration> getServletRegistrations()
javax.servlet.ServletContextgetServletRegistrations in interface ServletContextpublic java.lang.String getVirtualServerName()
javax.servlet.ServletContextgetVirtualServerName in interface ServletContextpublic int getSessionTimeout()
javax.servlet.ServletContextgetSessionTimeout in interface ServletContextpublic void setSessionTimeout(int sessionTimeout)
javax.servlet.ServletContextsetSessionTimeout in interface ServletContextsessionTimeout - The new default session timeout in minutes.public java.lang.String getRequestCharacterEncoding()
javax.servlet.ServletContextgetRequestCharacterEncoding in interface ServletContextnull if no default has
been specifiedpublic void setRequestCharacterEncoding(java.lang.String encoding)
javax.servlet.ServletContextsetRequestCharacterEncoding in interface ServletContextencoding - The name of the character encoding to usepublic java.lang.String getResponseCharacterEncoding()
javax.servlet.ServletContextgetResponseCharacterEncoding in interface ServletContextnull if no default has
been specifiedpublic void setResponseCharacterEncoding(java.lang.String encoding)
javax.servlet.ServletContextsetResponseCharacterEncoding in interface ServletContextencoding - The name of the character encoding to useCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.