Package org.apache.jasper.servlet
Class JspCServletContext
- java.lang.Object
-
- org.apache.jasper.servlet.JspCServletContext
-
- All Implemented Interfaces:
ServletContext
public class JspCServletContext extends java.lang.Object implements ServletContext
SimpleServletContext
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
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FilterRegistration.Dynamic
addFilter(java.lang.String filterName, Filter filter)
Add filter to context.FilterRegistration.Dynamic
addFilter(java.lang.String filterName, java.lang.Class<? extends Filter> filterClass)
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 commentsvoid
addListener(java.lang.String className)
TODO SERVLET3 - Add comments<T extends java.util.EventListener>
voidaddListener(T t)
TODO SERVLET3 - Add commentsServletRegistration.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.Class<? extends Servlet> servletClass)
Add servlet to context.ServletRegistration.Dynamic
addServlet(java.lang.String servletName, java.lang.String className)
Register a servlet implementation for use in this ServletContext.<T extends Filter>
TcreateFilter(java.lang.Class<T> c)
Create a Filter instance using the given class.<T extends java.util.EventListener>
TcreateListener(java.lang.Class<T> c)
TODO SERVLET3 - Add comments<T extends Servlet>
TcreateServlet(java.lang.Class<T> c)
Create an Servlet instance using the given class.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()
Obtain the major version of the servlet specification for which this web application is implemented.int
getEffectiveMinorVersion()
Obtain the minor version of the servlet specification for which this web application is implemented.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 commentsjava.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 replacementjava.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 replacementServletRegistration
getServletRegistration(java.lang.String servletName)
Obtain the details of the named servlet.java.util.Map<java.lang.String,? extends ServletRegistration>
getServletRegistrations()
Obtain a Map of servlet names to servlet registrations for all servlets registered with this context.java.util.Enumeration<Servlet>
getServlets()
Deprecated.This method has been deprecated with no replacementSessionCookieConfig
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) insteadvoid
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.
-
-
-
Constructor Detail
-
JspCServletContext
public JspCServletContext(java.io.PrintWriter aLogWriter, java.net.URL aResourceBaseURL, java.lang.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 thisServletContext
validate
- 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 Detail
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Return the specified context attribute, if any.- Specified by:
getAttribute
in interfaceServletContext
- Parameters:
name
- Name of the requested attribute- Returns:
- an
Object
containing the value of the attribute, ornull
if no attribute exists matching the given name - See Also:
ServletContext.getAttributeNames()
-
getAttributeNames
public java.util.Enumeration<java.lang.String> getAttributeNames()
Return an enumeration of context attribute names.- Specified by:
getAttributeNames
in interfaceServletContext
- Returns:
- an
Enumeration
of attribute names - See Also:
ServletContext.getAttribute(java.lang.String)
-
getContext
public ServletContext getContext(java.lang.String uripath)
Return the servlet context for the specified path.- Specified by:
getContext
in interfaceServletContext
- Parameters:
uripath
- Server-relative path starting with '/'- Returns:
- the
ServletContext
object that corresponds to the named URL, or null if either none exists or the container wishes to restrict this access. - See Also:
RequestDispatcher
-
getContextPath
public java.lang.String getContextPath()
Return the context path.- Specified by:
getContextPath
in interfaceServletContext
- Returns:
- The main context path
-
getInitParameter
public java.lang.String getInitParameter(java.lang.String name)
Return the specified context initialization parameter.- Specified by:
getInitParameter
in interfaceServletContext
- Parameters:
name
- Name of the requested parameter- Returns:
- a
String
containing the value of the initialization parameter - See Also:
ServletConfig.getInitParameter(java.lang.String)
-
getInitParameterNames
public java.util.Enumeration<java.lang.String> getInitParameterNames()
Return an enumeration of the names of context initialization parameters.- Specified by:
getInitParameterNames
in interfaceServletContext
- Returns:
- an
Enumeration
ofString
objects containing the names of the context's initialization parameters - See Also:
ServletConfig.getInitParameter(java.lang.String)
-
getMajorVersion
public int getMajorVersion()
Return the Servlet API major version number.- Specified by:
getMajorVersion
in interfaceServletContext
- Returns:
- 5
-
getMimeType
public java.lang.String getMimeType(java.lang.String file)
Return the MIME type for the specified filename.- Specified by:
getMimeType
in interfaceServletContext
- Parameters:
file
- Filename whose MIME type is requested- Returns:
- a
String
specifying the file's MIME type
-
getMinorVersion
public int getMinorVersion()
Return the Servlet API minor version number.- Specified by:
getMinorVersion
in interfaceServletContext
- Returns:
- 0
-
getNamedDispatcher
public RequestDispatcher getNamedDispatcher(java.lang.String name)
Return a request dispatcher for the specified servlet name.- Specified by:
getNamedDispatcher
in interfaceServletContext
- Parameters:
name
- Name of the requested servlet- Returns:
- a
RequestDispatcher
object that acts as a wrapper for the named servlet, ornull
if theServletContext
cannot return aRequestDispatcher
- See Also:
RequestDispatcher
,ServletContext.getContext(java.lang.String)
,ServletConfig.getServletName()
-
getRealPath
public java.lang.String getRealPath(java.lang.String path)
Return the real path for the specified context-relative virtual path.- Specified by:
getRealPath
in interfaceServletContext
- Parameters:
path
- The context-relative virtual path to resolve- Returns:
- a
String
specifying the real path, or null if the translation cannot be performed
-
getRequestDispatcher
public RequestDispatcher getRequestDispatcher(java.lang.String path)
Return a request dispatcher for the specified context-relative path.- Specified by:
getRequestDispatcher
in interfaceServletContext
- Parameters:
path
- Context-relative path for which to acquire a dispatcher- Returns:
- a
RequestDispatcher
object that acts as a wrapper for the resource at the specified path, ornull
if theServletContext
cannot return aRequestDispatcher
- See Also:
RequestDispatcher
,ServletContext.getContext(java.lang.String)
-
getResource
public java.net.URL getResource(java.lang.String path) throws java.net.MalformedURLException
Return a URL object of a resource that is mapped to the specified context-relative path.- Specified by:
getResource
in interfaceServletContext
- Parameters:
path
- Context-relative path of the desired resource- Returns:
- the resource located at the named path, or
null
if there is no resource at that path - Throws:
java.net.MalformedURLException
- if the resource path is not properly formed
-
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String path)
Return an InputStream allowing access to the resource at the specified context-relative path.- Specified by:
getResourceAsStream
in interfaceServletContext
- Parameters:
path
- Context-relative path of the desired resource- Returns:
- the
InputStream
returned to the servlet, ornull
if no resource exists at the specified path
-
getResourcePaths
public 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.- Specified by:
getResourcePaths
in interfaceServletContext
- Parameters:
path
- Context-relative base path- Returns:
- a Set containing the directory listing, or null if there are no resources in the web application whose path begins with the supplied path.
-
getServerInfo
public java.lang.String getServerInfo()
Return descriptive information about this server.- Specified by:
getServerInfo
in interfaceServletContext
- Returns:
- a
String
containing at least the servlet container name and version number
-
getServlet
@Deprecated public Servlet getServlet(java.lang.String name) throws ServletException
Deprecated.This method has been deprecated with no replacementReturn a null reference for the specified servlet name.- Specified by:
getServlet
in interfaceServletContext
- Parameters:
name
- Name of the requested servlet- Returns:
- Always
null
- Throws:
ServletException
- never
-
getServletContextName
public java.lang.String getServletContextName()
Return the name of this servlet context.- Specified by:
getServletContextName
in interfaceServletContext
- Returns:
- The name of the web application or null if no name has been declared in the deployment descriptor.
-
getServletNames
@Deprecated public java.util.Enumeration<java.lang.String> getServletNames()
Deprecated.This method has been deprecated with no replacementReturn an empty enumeration of servlet names.- Specified by:
getServletNames
in interfaceServletContext
- Returns:
- Always and empty Enumeration
-
getServlets
@Deprecated public java.util.Enumeration<Servlet> getServlets()
Deprecated.This method has been deprecated with no replacementReturn an empty enumeration of servlets.- Specified by:
getServlets
in interfaceServletContext
- Returns:
- Always and empty Enumeration
-
log
public void log(java.lang.String message)
Log the specified message.- Specified by:
log
in interfaceServletContext
- Parameters:
message
- The message to be logged
-
log
@Deprecated public void log(java.lang.Exception exception, java.lang.String message)
Deprecated.Use log(String,Throwable) insteadLog the specified message and exception.- Specified by:
log
in interfaceServletContext
- Parameters:
exception
- The exception to be loggedmessage
- The message to be logged
-
log
public void log(java.lang.String message, java.lang.Throwable exception)
Log the specified message and exception.- Specified by:
log
in interfaceServletContext
- Parameters:
message
- The message to be loggedexception
- The exception to be logged
-
removeAttribute
public void removeAttribute(java.lang.String name)
Remove the specified context attribute.- Specified by:
removeAttribute
in interfaceServletContext
- Parameters:
name
- Name of the attribute to remove
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)
Set or replace the specified context attribute.- Specified by:
setAttribute
in interfaceServletContext
- Parameters:
name
- Name of the context attribute to setvalue
- Corresponding attribute value
-
addFilter
public FilterRegistration.Dynamic addFilter(java.lang.String filterName, java.lang.String className)
Description copied from interface:jakarta.servlet.ServletContext
Add filter to context.- Specified by:
addFilter
in interfaceServletContext
- Parameters:
filterName
- Name of filter to addclassName
- Name of filter class- Returns:
null
if the filter has already been fully defined, else aFilterRegistration.Dynamic
object that can be used to further configure the filter
-
addServlet
public ServletRegistration.Dynamic addServlet(java.lang.String servletName, java.lang.String className)
Description copied from interface:jakarta.servlet.ServletContext
Register a servlet implementation for use in this ServletContext.- Specified by:
addServlet
in interfaceServletContext
- Parameters:
servletName
- The name of the servlet to registerclassName
- The implementation class for the servlet- Returns:
- The registration object that enables further configuration
-
getDefaultSessionTrackingModes
public java.util.Set<SessionTrackingMode> getDefaultSessionTrackingModes()
Description copied from interface:jakarta.servlet.ServletContext
Obtains the default session tracking modes for this web application. By defaultSessionTrackingMode.URL
is always supported,SessionTrackingMode.COOKIE
is supported unless thecookies
attribute has been set tofalse
for the context andSessionTrackingMode.SSL
is supported if at least one of the connectors used by this context has the attributesecure
set totrue
.- Specified by:
getDefaultSessionTrackingModes
in interfaceServletContext
- Returns:
- The set of default session tracking modes for this web application
-
getEffectiveSessionTrackingModes
public java.util.Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
Description copied from interface:jakarta.servlet.ServletContext
Obtains the currently enabled session tracking modes for this web application.- Specified by:
getEffectiveSessionTrackingModes
in interfaceServletContext
- Returns:
- The value supplied via
ServletContext.setSessionTrackingModes(Set)
if one was previously set, else return the defaults
-
getSessionCookieConfig
public SessionCookieConfig getSessionCookieConfig()
- Specified by:
getSessionCookieConfig
in interfaceServletContext
- Returns:
- TODO
-
setSessionTrackingModes
public void setSessionTrackingModes(java.util.Set<SessionTrackingMode> sessionTrackingModes)
Description copied from interface:jakarta.servlet.ServletContext
Configures the available session tracking modes for this web application.- Specified by:
setSessionTrackingModes
in interfaceServletContext
- Parameters:
sessionTrackingModes
- The session tracking modes to use for this web application
-
addFilter
public FilterRegistration.Dynamic addFilter(java.lang.String filterName, Filter filter)
Description copied from interface:jakarta.servlet.ServletContext
Add filter to context.- Specified by:
addFilter
in interfaceServletContext
- Parameters:
filterName
- Name of filter to addfilter
- Filter to add- Returns:
null
if the filter has already been fully defined, else aFilterRegistration.Dynamic
object that can be used to further configure the filter
-
addFilter
public FilterRegistration.Dynamic addFilter(java.lang.String filterName, java.lang.Class<? extends Filter> filterClass)
Description copied from interface:jakarta.servlet.ServletContext
Add filter to context.- Specified by:
addFilter
in interfaceServletContext
- Parameters:
filterName
- Name of filter to addfilterClass
- Class of filter to add- Returns:
null
if the filter has already been fully defined, else aFilterRegistration.Dynamic
object that can be used to further configure the filter
-
addServlet
public ServletRegistration.Dynamic addServlet(java.lang.String servletName, Servlet servlet)
Description copied from interface:jakarta.servlet.ServletContext
Register a servlet instance for use in this ServletContext.- Specified by:
addServlet
in interfaceServletContext
- Parameters:
servletName
- The name of the servlet to registerservlet
- The Servlet instance to register- Returns:
- The registration object that enables further configuration
-
addServlet
public ServletRegistration.Dynamic addServlet(java.lang.String servletName, java.lang.Class<? extends Servlet> servletClass)
Description copied from interface:jakarta.servlet.ServletContext
Add servlet to context.- Specified by:
addServlet
in interfaceServletContext
- Parameters:
servletName
- Name of servlet to addservletClass
- Class of servlet to add- Returns:
null
if the servlet has already been fully defined, else aServletRegistration.Dynamic
object that can be used to further configure the servlet
-
addJspFile
public ServletRegistration.Dynamic addJspFile(java.lang.String jspName, java.lang.String jspFile)
- Specified by:
addJspFile
in interfaceServletContext
- Parameters:
jspName
- 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 servlet- Returns:
- a
ServletRegistration.Dynamic
object that can be used to further configure the servlet
-
createFilter
public <T extends Filter> T createFilter(java.lang.Class<T> c) throws ServletException
Description copied from interface:jakarta.servlet.ServletContext
Create a Filter instance using the given class. The instance is just created. No initialisation occurs.- Specified by:
createFilter
in interfaceServletContext
- Type Parameters:
T
- The type for the given class- Parameters:
c
- The the class for which an instance should be created- Returns:
- The created Filter instance.
- Throws:
ServletException
- If the Filter instance cannot be created
-
createServlet
public <T extends Servlet> T createServlet(java.lang.Class<T> c) throws ServletException
Description copied from interface:jakarta.servlet.ServletContext
Create an Servlet instance using the given class. The instance is just created. No initialisation occurs.- Specified by:
createServlet
in interfaceServletContext
- Type Parameters:
T
- The type for the given class- Parameters:
c
- The the class for which an instance should be created- Returns:
- The created Servlet instance.
- Throws:
ServletException
- If the servlet instance cannot be created.
-
getFilterRegistration
public FilterRegistration getFilterRegistration(java.lang.String filterName)
Description copied from interface:jakarta.servlet.ServletContext
TODO SERVLET3 - Add comments- Specified by:
getFilterRegistration
in interfaceServletContext
- Parameters:
filterName
- TODO- Returns:
- TODO
-
getServletRegistration
public ServletRegistration getServletRegistration(java.lang.String servletName)
Description copied from interface:jakarta.servlet.ServletContext
Obtain the details of the named servlet.- Specified by:
getServletRegistration
in interfaceServletContext
- Parameters:
servletName
- The name of the Servlet of interest- Returns:
- The registration details for the named Servlet or
null
if no Servlet has been registered with the given name
-
setInitParameter
public boolean setInitParameter(java.lang.String name, java.lang.String value)
Description copied from interface:jakarta.servlet.ServletContext
Set the given initialisation parameter to the given value.- Specified by:
setInitParameter
in interfaceServletContext
- Parameters:
name
- Name of initialisation parametervalue
- Value for initialisation parameter- Returns:
true
if the call succeeds orfalse
if the call fails because an initialisation parameter with the same name has already been set
-
addListener
public void addListener(java.lang.Class<? extends java.util.EventListener> listenerClass)
Description copied from interface:jakarta.servlet.ServletContext
TODO SERVLET3 - Add comments- Specified by:
addListener
in interfaceServletContext
- Parameters:
listenerClass
- TODO
-
addListener
public void addListener(java.lang.String className)
Description copied from interface:jakarta.servlet.ServletContext
TODO SERVLET3 - Add comments- Specified by:
addListener
in interfaceServletContext
- Parameters:
className
- TODO
-
addListener
public <T extends java.util.EventListener> void addListener(T t)
Description copied from interface:jakarta.servlet.ServletContext
TODO SERVLET3 - Add comments- Specified by:
addListener
in interfaceServletContext
- Type Parameters:
T
- TODO- Parameters:
t
- TODO
-
createListener
public <T extends java.util.EventListener> T createListener(java.lang.Class<T> c) throws ServletException
Description copied from interface:jakarta.servlet.ServletContext
TODO SERVLET3 - Add comments- Specified by:
createListener
in interfaceServletContext
- Type Parameters:
T
- TODO- Parameters:
c
- TODO- Returns:
- TODO
- Throws:
ServletException
- TODO
-
declareRoles
public void declareRoles(java.lang.String... roleNames)
Description copied from interface:jakarta.servlet.ServletContext
Add to the declared roles for this ServletContext.- Specified by:
declareRoles
in interfaceServletContext
- Parameters:
roleNames
- The roles to add
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:jakarta.servlet.ServletContext
Get the web application class loader associated with this ServletContext.- Specified by:
getClassLoader
in interfaceServletContext
- Returns:
- The associated web application class loader
-
getEffectiveMajorVersion
public int getEffectiveMajorVersion()
Description copied from interface:jakarta.servlet.ServletContext
Obtain the major version of the servlet specification for which this web application is implemented.- Specified by:
getEffectiveMajorVersion
in interfaceServletContext
- Returns:
- The major version declared in web.xml
-
getEffectiveMinorVersion
public int getEffectiveMinorVersion()
Description copied from interface:jakarta.servlet.ServletContext
Obtain the minor version of the servlet specification for which this web application is implemented.- Specified by:
getEffectiveMinorVersion
in interfaceServletContext
- Returns:
- The minor version declared in web.xml
-
getFilterRegistrations
public java.util.Map<java.lang.String,? extends FilterRegistration> getFilterRegistrations()
- Specified by:
getFilterRegistrations
in interfaceServletContext
- Returns:
- TODO
-
getJspConfigDescriptor
public JspConfigDescriptor getJspConfigDescriptor()
- Specified by:
getJspConfigDescriptor
in interfaceServletContext
- Returns:
- TODO
-
getServletRegistrations
public java.util.Map<java.lang.String,? extends ServletRegistration> getServletRegistrations()
Description copied from interface:jakarta.servlet.ServletContext
Obtain a Map of servlet names to servlet registrations for all servlets registered with this context.- Specified by:
getServletRegistrations
in interfaceServletContext
- Returns:
- A Map of servlet names to servlet registrations for all servlets registered with this context
-
getVirtualServerName
public java.lang.String getVirtualServerName()
Description copied from interface:jakarta.servlet.ServletContext
Get the primary name of the virtual host on which this context is deployed. The name may or may not be a valid host name.- Specified by:
getVirtualServerName
in interfaceServletContext
- Returns:
- The primary name of the virtual host on which this context is deployed
-
getSessionTimeout
public int getSessionTimeout()
Description copied from interface:jakarta.servlet.ServletContext
Get the default session timeout.- Specified by:
getSessionTimeout
in interfaceServletContext
- Returns:
- The current default session timeout in minutes
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout)
Description copied from interface:jakarta.servlet.ServletContext
Set the default session timeout. This method may only be called before the ServletContext is initialised.- Specified by:
setSessionTimeout
in interfaceServletContext
- Parameters:
sessionTimeout
- The new default session timeout in minutes.
-
getRequestCharacterEncoding
public java.lang.String getRequestCharacterEncoding()
Description copied from interface:jakarta.servlet.ServletContext
Get the default character encoding for reading request bodies.- Specified by:
getRequestCharacterEncoding
in interfaceServletContext
- Returns:
- The character encoding name or
null
if no default has been specified
-
setRequestCharacterEncoding
public void setRequestCharacterEncoding(java.lang.String encoding)
Description copied from interface:jakarta.servlet.ServletContext
Set the default character encoding to use for reading request bodies. Calling this method will over-ride any value set in the deployment descriptor.- Specified by:
setRequestCharacterEncoding
in interfaceServletContext
- Parameters:
encoding
- The name of the character encoding to use
-
getResponseCharacterEncoding
public java.lang.String getResponseCharacterEncoding()
Description copied from interface:jakarta.servlet.ServletContext
Get the default character encoding for writing response bodies.- Specified by:
getResponseCharacterEncoding
in interfaceServletContext
- Returns:
- The character encoding name or
null
if no default has been specified
-
setResponseCharacterEncoding
public void setResponseCharacterEncoding(java.lang.String encoding)
Description copied from interface:jakarta.servlet.ServletContext
Set the default character encoding to use for writing response bodies. Calling this method will over-ride any value set in the deployment descriptor.- Specified by:
setResponseCharacterEncoding
in interfaceServletContext
- Parameters:
encoding
- The name of the character encoding to use
-
-