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.jakarta.WebContext
org.apache.commons.chain.web.jakarta.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
ConstructorsConstructorDescriptionConstruct an uninitializedServletWebContextinstance.ServletWebContext(jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Construct aServletWebContextinstance that is initialized with the specified Servlet API objects. -
Method Summary
Modifier and TypeMethodDescriptionSee theWebContext's Javadoc.jakarta.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.jakarta.servlet.http.HttpServletRequestReturn theHttpServletRequestfor this context.See theWebContext's Javadoc.jakarta.servlet.http.HttpServletResponseReturn theHttpServletResponsefor this context.See theWebContext's Javadoc.voidinitialize(jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.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 org.apache.commons.chain.impl.ContextBase
clear, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 uninitializedServletWebContextinstance. -
ServletWebContext
public ServletWebContext(jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Construct aServletWebContextinstance that is initialized with the specified Servlet API objects.- Parameters:
context- TheServletContextfor this web applicationrequest- TheHttpServletRequestfor this requestresponse- TheHttpServletResponsefor this request
-
-
Method Details
-
getContext
Return theServletContextfor this context.- Returns:
- The
ServletContextfor this context.
-
getRequest
Return theHttpServletRequestfor this context.- Returns:
- The
HttpServletRequestfor this context.
-
getResponse
Return theHttpServletResponsefor this context.- Returns:
- The
HttpServletResponsefor this context.
-
initialize
public void initialize(jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initialize (or reinitialize) thisServletWebContextinstance for the specified Servlet API objects.- Parameters:
context- TheServletContextfor this web applicationrequest- TheHttpServletRequestfor this requestresponse- TheHttpServletResponsefor 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:
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.
-