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 AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MapThe lazily instantiatedMapof application scope attributes.protected javax.servlet.ServletContextTheServletContextfor this web application.private MapThe lazily instantiatedMapof cookies.private MapThe lazily instantiatedMapof header name-value combinations (immutable).private MapThe lazily instantitatedMapof header name-values combinations (immutable).private MapThe lazily instantiatedMapof context initialization parameters.private MapThe lazily instantiatedMapof request parameter name-value.private MapThe lazily instantiatedMapof request parameter name-values.protected javax.servlet.http.HttpServletRequestTheHttpServletRequestfor this request.private MapThe lazily instantiatedMapof request scope attributes.protected javax.servlet.http.HttpServletResponseTheHttpServletResponsefor this request.private MapThe lazily instantiatedMapof session scope attributes. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an uninitializedServletWebContextinstance.ServletWebContext(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Construct aServletWebContextinstance that is initialized with the specified Servlet API objects. -
Method Summary
Modifier and TypeMethodDescriptionSee theWebContext's Javadoc.javax.servlet.ServletContextReturn theServletContextfor 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.HttpServletRequestReturn theHttpServletRequestfor this context.See theWebContext's Javadoc.javax.servlet.http.HttpServletResponseReturn theHttpServletResponsefor this context.See theWebContext's Javadoc.voidinitialize(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Initialize (or reinitialize) thisServletWebContextinstance for the specified Servlet API objects.voidrelease()Release references to allocated resources acquired ininitialize()of via subsequent processing.Methods inherited from class ContextBase
clear, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, valuesMethods inherited from class HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, forEach, getOrDefault, merge, newHashMap, putIfAbsent, remove, replace, replace, replaceAll, sizeMethods inherited from class AbstractMap
equals, hashCode, toStringMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll, size
-
Field Details
-
applicationScope
The lazily instantiated
Mapof application scope attributes. -
context
protected javax.servlet.ServletContext contextThe
ServletContextfor this web application. -
header
The lazily instantiated
Mapof header name-value combinations (immutable). -
headerValues
The lazily instantitated
Mapof header name-values combinations (immutable). -
initParam
The lazily instantiated
Mapof context initialization parameters. -
cookieValues
The lazily instantiated
Mapof cookies. -
param
The lazily instantiated
Mapof request parameter name-value. -
paramValues
The lazily instantiated
Mapof request parameter name-values. -
request
protected javax.servlet.http.HttpServletRequest requestThe
HttpServletRequestfor this request. -
requestScope
The lazily instantiated
Mapof request scope attributes. -
response
protected javax.servlet.http.HttpServletResponse responseThe
HttpServletResponsefor this request. -
sessionScope
The lazily instantiated
Mapof session scope attributes.
-
-
Constructor Details
-
ServletWebContext
public ServletWebContext()Construct an uninitialized
ServletWebContextinstance. -
ServletWebContext
public ServletWebContext(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Construct a
ServletWebContextinstance that is initialized with the specified Servlet API objects.- Parameters:
context- TheServletContextfor this web applicationrequest- TheHttpServletRequestfor this requestresponse- TheHttpServletResponsefor this request
-
-
Method Details
-
getContext
public javax.servlet.ServletContext getContext()Return the
ServletContextfor this context.- Returns:
- The
ServletContextfor this context.
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()Return the
HttpServletRequestfor this context.- Returns:
- The
HttpServletRequestfor this context.
-
getResponse
public javax.servlet.http.HttpServletResponse getResponse()Return the
HttpServletResponsefor this context.- Returns:
- The
HttpServletResponsefor this context.
-
initialize
public void initialize(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Initialize (or reinitialize) this
ServletWebContextinstance for the specified Servlet API objects.- Parameters:
context- TheServletContextfor this web applicationrequest- TheHttpServletRequestfor this requestresponse- TheHttpServletResponsefor 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:
getApplicationScopein classWebContext- Returns:
- Application scope Map.
-
getHeader
See theWebContext's Javadoc.- Specified by:
getHeaderin classWebContext- Returns:
- Header values Map.
-
getHeaderValues
See theWebContext's Javadoc.- Specified by:
getHeaderValuesin classWebContext- Returns:
- Header values Map.
-
getInitParam
See theWebContext's Javadoc.- Specified by:
getInitParamin classWebContext- Returns:
- Initialization parameter Map.
-
getParam
See theWebContext's Javadoc.- Specified by:
getParamin classWebContext- Returns:
- Request parameter Map.
-
getParamValues
See theWebContext's Javadoc.- Specified by:
getParamValuesin classWebContext- Returns:
- Request parameter Map.
-
getCookies
See theWebContext's Javadoc.- Specified by:
getCookiesin classWebContext- Returns:
- Map of Cookies.
- Since:
- Chain 1.1
-
getRequestScope
See theWebContext's Javadoc.- Specified by:
getRequestScopein classWebContext- Returns:
- Request scope Map.
-
getSessionScope
See theWebContext's Javadoc.- Specified by:
getSessionScopein classWebContext- Returns:
- Session scope Map.
-