public class ServletWebContext extends WebContext
Concrete implementation of WebContext
suitable for use in
Servlets and JSP pages. The abstract methods are mapped to the appropriate
collections of the underlying servlet context, request, and response
instances that are passed to the constructor (or the initialize method).
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
protected javax.servlet.ServletContext |
context
The
ServletContext for this web application. |
protected javax.servlet.http.HttpServletRequest |
request
The
HttpServletRequest for this request. |
protected javax.servlet.http.HttpServletResponse |
response
The
HttpServletResponse for this request. |
Constructor and Description |
---|
ServletWebContext()
Construct an uninitialized
ServletWebContext instance. |
ServletWebContext(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Construct a
ServletWebContext instance that is initialized
with the specified Servlet API objects. |
Modifier and Type | Method and Description |
---|---|
Map |
getApplicationScope()
See the
WebContext 's Javadoc. |
javax.servlet.ServletContext |
getContext()
Return the
ServletContext for this context. |
Map |
getCookies()
See the
WebContext 's Javadoc. |
Map |
getHeader()
See the
WebContext 's Javadoc. |
Map |
getHeaderValues()
See the
WebContext 's Javadoc. |
Map |
getInitParam()
See the
WebContext 's Javadoc. |
Map |
getParam()
See the
WebContext 's Javadoc. |
Map |
getParamValues()
See the
WebContext 's Javadoc. |
javax.servlet.http.HttpServletRequest |
getRequest()
Return the
HttpServletRequest for this context. |
Map |
getRequestScope()
See the
WebContext 's Javadoc. |
javax.servlet.http.HttpServletResponse |
getResponse()
Return the
HttpServletResponse for this context. |
Map |
getSessionScope()
See the
WebContext 's Javadoc. |
void |
initialize(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Initialize (or reinitialize) this
ServletWebContext instance
for the specified Servlet API objects. |
void |
release()
Release references to allocated resources acquired in
initialize() of via subsequent processing. |
clear, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll, size
equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, containsKey, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll, size
protected javax.servlet.ServletContext context
The ServletContext
for this web application.
protected javax.servlet.http.HttpServletRequest request
The HttpServletRequest
for this request.
protected javax.servlet.http.HttpServletResponse response
The HttpServletResponse
for this request.
public ServletWebContext()
Construct an uninitialized ServletWebContext
instance.
public ServletWebContext(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Construct a ServletWebContext
instance that is initialized
with the specified Servlet API objects.
context
- The ServletContext
for this web applicationrequest
- The HttpServletRequest
for this requestresponse
- The HttpServletResponse
for this requestpublic javax.servlet.ServletContext getContext()
Return the ServletContext
for this context.
ServletContext
for this context.public javax.servlet.http.HttpServletRequest getRequest()
Return the HttpServletRequest
for this context.
HttpServletRequest
for this context.public javax.servlet.http.HttpServletResponse getResponse()
Return the HttpServletResponse
for this context.
HttpServletResponse
for this context.public void initialize(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Initialize (or reinitialize) this ServletWebContext
instance
for the specified Servlet API objects.
context
- The ServletContext
for this web applicationrequest
- The HttpServletRequest
for this requestresponse
- The HttpServletResponse
for this requestpublic void release()
Release references to allocated resources acquired in
initialize()
of via subsequent processing. After this
method is called, subsequent calls to any other method than
initialize()
will return undefined results.
public Map getApplicationScope()
WebContext
's Javadoc.getApplicationScope
in class WebContext
public Map getHeader()
WebContext
's Javadoc.getHeader
in class WebContext
public Map getHeaderValues()
WebContext
's Javadoc.getHeaderValues
in class WebContext
public Map getInitParam()
WebContext
's Javadoc.getInitParam
in class WebContext
public Map getParam()
WebContext
's Javadoc.getParam
in class WebContext
public Map getParamValues()
WebContext
's Javadoc.getParamValues
in class WebContext
public Map getCookies()
WebContext
's Javadoc.getCookies
in class WebContext
public Map getRequestScope()
WebContext
's Javadoc.getRequestScope
in class WebContext
public Map getSessionScope()
WebContext
's Javadoc.getSessionScope
in class WebContext
Copyright © 2003–2021 The Apache Software Foundation. All rights reserved.