Class ServletWebContext
java.lang.Object
java.util.AbstractMap<String,Object>
java.util.HashMap<String,Object>
org.apache.commons.chain.impl.ContextBase
org.apache.commons.chain.web.javax.WebContext
org.apache.commons.chain.web.javax.servlet.ServletWebContext
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).- 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> -
Constructor Summary
ConstructorDescriptionConstruct an uninitializedServletWebContext
instance.ServletWebContext
(ServletContext context, HttpServletRequest request, HttpServletResponse response) Construct aServletWebContext
instance that is initialized with the specified Servlet API objects. -
Method Summary
Modifier and TypeMethodDescriptionSee theWebContext
's Javadoc.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.Return theHttpServletRequest
for this context.See theWebContext
's Javadoc.Return theHttpServletResponse
for this context.See theWebContext
's Javadoc.void
initialize
(ServletContext context, HttpServletRequest request, 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, 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
-
Constructor Details
-
ServletWebContext
public ServletWebContext()Construct an uninitializedServletWebContext
instance. -
ServletWebContext
public ServletWebContext(ServletContext context, HttpServletRequest request, HttpServletResponse response) Construct aServletWebContext
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
Return theServletContext
for this context.- Returns:
- The
ServletContext
for this context.
-
getRequest
Return theHttpServletRequest
for this context.- Returns:
- The
HttpServletRequest
for this context.
-
getResponse
Return theHttpServletResponse
for this context.- Returns:
- The
HttpServletResponse
for this context.
-
initialize
public void initialize(ServletContext context, HttpServletRequest request, HttpServletResponse response) Initialize (or reinitialize) thisServletWebContext
instance for the specified Servlet API objects.- Parameters:
context
- TheServletContext
for this web applicationrequest
- TheHttpServletRequest
for this requestresponse
- TheHttpServletResponse
for this request
-
release
Release references to allocated resources acquired ininitialize()
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.
-