Class ServletWebContext
- All Implemented Interfaces:
Serializable
,Cloneable
,Map
,Context
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).
- Version:
- $Revision: 480477 $ $Date: 2006-11-29 08:34:52 +0000 (Wed, 29 Nov 2006) $
- Author:
- Craig R. McClanahan
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map
The lazily instantiatedMap
of application scope attributes.protected javax.servlet.ServletContext
TheServletContext
for this web application.private Map
The lazily instantiatedMap
of cookies.private Map
The lazily instantiatedMap
of header name-value combinations (immutable).private Map
The lazily instantitatedMap
of header name-values combinations (immutable).private Map
The lazily instantiatedMap
of context initialization parameters.private Map
The lazily instantiatedMap
of request parameter name-value.private Map
The lazily instantiatedMap
of request parameter name-values.protected javax.servlet.http.HttpServletRequest
TheHttpServletRequest
for this request.private Map
The lazily instantiatedMap
of request scope attributes.protected javax.servlet.http.HttpServletResponse
TheHttpServletResponse
for this request.private Map
The lazily instantiatedMap
of session scope attributes. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an uninitializedServletWebContext
instance.ServletWebContext
(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Construct aServletWebContext
instance that is initialized with the specified Servlet API objects. -
Method Summary
Modifier and TypeMethodDescriptionSee theWebContext
's Javadoc.javax.servlet.ServletContext
Return theServletContext
for this context.See theWebContext
's Javadoc.See theWebContext
's Javadoc.See theWebContext
's Javadoc.See theWebContext
's Javadoc.getParam()
See theWebContext
's Javadoc.See theWebContext
's Javadoc.javax.servlet.http.HttpServletRequest
Return theHttpServletRequest
for this context.See theWebContext
's Javadoc.javax.servlet.http.HttpServletResponse
Return theHttpServletResponse
for this context.See theWebContext
's Javadoc.void
initialize
(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Initialize (or reinitialize) thisServletWebContext
instance for the specified Servlet API objects.void
release()
Release references to allocated resources acquired ininitialize()
of via subsequent processing.Methods inherited from class org.apache.commons.chain.impl.ContextBase
clear, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, forEach, getOrDefault, merge, newHashMap, putIfAbsent, remove, replace, replace, replaceAll, size
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll, size
-
Field Details
-
applicationScope
The lazily instantiated
Map
of application scope attributes. -
context
protected javax.servlet.ServletContext contextThe
ServletContext
for this web application. -
header
The lazily instantiated
Map
of header name-value combinations (immutable). -
headerValues
The lazily instantitated
Map
of header name-values combinations (immutable). -
initParam
The lazily instantiated
Map
of context initialization parameters. -
cookieValues
The lazily instantiated
Map
of cookies. -
param
The lazily instantiated
Map
of request parameter name-value. -
paramValues
The lazily instantiated
Map
of request parameter name-values. -
request
protected javax.servlet.http.HttpServletRequest requestThe
HttpServletRequest
for this request. -
requestScope
The lazily instantiated
Map
of request scope attributes. -
response
protected javax.servlet.http.HttpServletResponse responseThe
HttpServletResponse
for this request. -
sessionScope
The lazily instantiated
Map
of session scope attributes.
-
-
Constructor Details
-
ServletWebContext
public ServletWebContext()Construct an uninitialized
ServletWebContext
instance. -
ServletWebContext
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.- Parameters:
context
- TheServletContext
for this web applicationrequest
- TheHttpServletRequest
for this requestresponse
- TheHttpServletResponse
for this request
-
-
Method Details
-
getContext
public javax.servlet.ServletContext getContext()Return the
ServletContext
for this context.- Returns:
- The
ServletContext
for this context.
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()Return the
HttpServletRequest
for this context.- Returns:
- The
HttpServletRequest
for this context.
-
getResponse
public javax.servlet.http.HttpServletResponse getResponse()Return the
HttpServletResponse
for this context.- Returns:
- The
HttpServletResponse
for this context.
-
initialize
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.- Parameters:
context
- TheServletContext
for this web applicationrequest
- TheHttpServletRequest
for this requestresponse
- TheHttpServletResponse
for this request
-
release
public 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 thaninitialize()
will return undefined results. -
getApplicationScope
See theWebContext
's Javadoc.- Specified by:
getApplicationScope
in classWebContext
- Returns:
- Application scope Map.
-
getHeader
See theWebContext
's Javadoc.- Specified by:
getHeader
in classWebContext
- Returns:
- Header values Map.
-
getHeaderValues
See theWebContext
's Javadoc.- Specified by:
getHeaderValues
in classWebContext
- Returns:
- Header values Map.
-
getInitParam
See theWebContext
's Javadoc.- Specified by:
getInitParam
in classWebContext
- Returns:
- Initialization parameter Map.
-
getParam
See theWebContext
's Javadoc.- Specified by:
getParam
in classWebContext
- Returns:
- Request parameter Map.
-
getParamValues
See theWebContext
's Javadoc.- Specified by:
getParamValues
in classWebContext
- Returns:
- Request parameter Map.
-
getCookies
See theWebContext
's Javadoc.- Specified by:
getCookies
in classWebContext
- Returns:
- Map of Cookies.
- Since:
- Chain 1.1
-
getRequestScope
See theWebContext
's Javadoc.- Specified by:
getRequestScope
in classWebContext
- Returns:
- Request scope Map.
-
getSessionScope
See theWebContext
's Javadoc.- Specified by:
getSessionScope
in classWebContext
- Returns:
- Session scope Map.
-