org.apache.commons.chain.web.portlet
Class PortletWebContext

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by org.apache.commons.chain.impl.ContextBase
              extended by org.apache.commons.chain.web.WebContext
                  extended by org.apache.commons.chain.web.portlet.PortletWebContext
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map, Context

public class PortletWebContext
extends WebContext

Concrete implementation of WebContext suitable for use in portlets. The abstract methods are mapped to the appropriate collections of the underlying portlet context, request, and response instances that are passed to the constructor (or the initialize method).

Version:
$Revision: 412789 $ $Date: 2006-06-08 17:19:14 +0100 (Thu, 08 Jun 2006) $
Author:
Craig R. McClanahan
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
private  java.util.Map applicationScope
          The lazily instantiated Map of application scope attributes.
protected  javax.portlet.PortletContext context
          The PortletContext for this web application.
private  java.util.Map header
          The lazily instantiated Map of header name-value combinations (immutable).
private  java.util.Map headerValues
          The lazily instantitated Map of header name-values combinations (immutable).
private  java.util.Map initParam
          The lazily instantiated Map of context initialization parameters.
private  java.util.Map param
          The lazily instantiated Map of request parameter name-value.
private  java.util.Map paramValues
          The lazily instantiated Map of request parameter name-values.
protected  javax.portlet.PortletRequest request
          The PortletRequest for this request.
private  java.util.Map requestScope
          The lazily instantiated Map of request scope attributes.
protected  javax.portlet.PortletResponse response
          The PortletResponse for this request.
private  java.util.Map sessionScope
          The lazily instantiated Map of session scope attributes.
 
Constructor Summary
PortletWebContext()
          Construct an uninitialized PortletWebContext instance.
PortletWebContext(javax.portlet.PortletContext context, javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)
          Construct a PortletWebContext instance that is initialized with the specified Portlet API objects.
 
Method Summary
 java.util.Map getApplicationScope()
          See the WebContext's Javadoc.
 javax.portlet.PortletContext getContext()
          Return the PortletContext for this context.
 java.util.Map getCookies()
          Returns an empty Map - portlets don't support Cookies.
 java.util.Map getHeader()
          See the WebContext's Javadoc.
 java.util.Map getHeaderValues()
          See the WebContext's Javadoc.
 java.util.Map getInitParam()
          See the WebContext's Javadoc.
 java.util.Map getParam()
          See the WebContext's Javadoc.
 java.util.Map getParamValues()
          See the WebContext's Javadoc.
 javax.portlet.PortletRequest getRequest()
          Return the PortletRequest for this context.
 java.util.Map getRequestScope()
          See the WebContext's Javadoc.
 javax.portlet.PortletResponse getResponse()
          Return the PortletResponse for this context.
 java.util.Map getSessionScope()
          See the WebContext's Javadoc.
 void initialize(javax.portlet.PortletContext context, javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)
          Initialize (or reinitialize) this PortletWebContext instance for the specified Portlet API objects.
 void release()
          Release references to allocated resources acquired in initialize() 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, containsKey, 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
containsKey, equals, hashCode, size
 

Field Detail

applicationScope

private java.util.Map applicationScope

The lazily instantiated Map of application scope attributes.


context

protected javax.portlet.PortletContext context

The PortletContext for this web application.


header

private java.util.Map header

The lazily instantiated Map of header name-value combinations (immutable).


headerValues

private java.util.Map headerValues

The lazily instantitated Map of header name-values combinations (immutable).


initParam

private java.util.Map initParam

The lazily instantiated Map of context initialization parameters.


param

private java.util.Map param

The lazily instantiated Map of request parameter name-value.


paramValues

private java.util.Map paramValues

The lazily instantiated Map of request parameter name-values.


request

protected javax.portlet.PortletRequest request

The PortletRequest for this request.


requestScope

private java.util.Map requestScope

The lazily instantiated Map of request scope attributes.


response

protected javax.portlet.PortletResponse response

The PortletResponse for this request.


sessionScope

private java.util.Map sessionScope

The lazily instantiated Map of session scope attributes.

Constructor Detail

PortletWebContext

public PortletWebContext()

Construct an uninitialized PortletWebContext instance.


PortletWebContext

public PortletWebContext(javax.portlet.PortletContext context,
                         javax.portlet.PortletRequest request,
                         javax.portlet.PortletResponse response)

Construct a PortletWebContext instance that is initialized with the specified Portlet API objects.

Parameters:
context - The PortletContext for this web application
request - The PortletRequest for this request
response - The PortletResponse for this request
Method Detail

getContext

public javax.portlet.PortletContext getContext()

Return the PortletContext for this context.

Returns:
The PortletContext for this request

getRequest

public javax.portlet.PortletRequest getRequest()

Return the PortletRequest for this context.

Returns:
The PortletRequest for this context.

getResponse

public javax.portlet.PortletResponse getResponse()

Return the PortletResponse for this context.

Returns:
The PortletResponse for this context.

initialize

public void initialize(javax.portlet.PortletContext context,
                       javax.portlet.PortletRequest request,
                       javax.portlet.PortletResponse response)

Initialize (or reinitialize) this PortletWebContext instance for the specified Portlet API objects.

Parameters:
context - The PortletContext for this web application
request - The PortletRequest for this request
response - The PortletResponse 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 than initialize() will return undefined results.


getApplicationScope

public java.util.Map getApplicationScope()
See the WebContext's Javadoc.

Specified by:
getApplicationScope in class WebContext
Returns:
Application scope Map.

getHeader

public java.util.Map getHeader()
See the WebContext's Javadoc.

Specified by:
getHeader in class WebContext
Returns:
Header values Map.

getHeaderValues

public java.util.Map getHeaderValues()
See the WebContext's Javadoc.

Specified by:
getHeaderValues in class WebContext
Returns:
Header values Map.

getInitParam

public java.util.Map getInitParam()
See the WebContext's Javadoc.

Specified by:
getInitParam in class WebContext
Returns:
Initialization parameter Map.

getParam

public java.util.Map getParam()
See the WebContext's Javadoc.

Specified by:
getParam in class WebContext
Returns:
Request parameter Map.

getParamValues

public java.util.Map getParamValues()
See the WebContext's Javadoc.

Specified by:
getParamValues in class WebContext
Returns:
Request parameter Map.

getCookies

public java.util.Map getCookies()
Returns an empty Map - portlets don't support Cookies.

Specified by:
getCookies in class WebContext
Returns:
An empty Map.
Since:
Chain 1.1

getRequestScope

public java.util.Map getRequestScope()
See the WebContext's Javadoc.

Specified by:
getRequestScope in class WebContext
Returns:
Request scope Map.

getSessionScope

public java.util.Map getSessionScope()
See the WebContext's Javadoc.

Specified by:
getSessionScope in class WebContext
Returns:
Session scope Map.