spring-webmvc-portlet

org.springframework.web.portlet.context
Class PortletRequestAttributes

java.lang.Object
  extended by org.springframework.web.context.request.AbstractRequestAttributes
      extended by org.springframework.web.portlet.context.PortletRequestAttributes
All Implemented Interfaces:
org.springframework.web.context.request.RequestAttributes
Direct Known Subclasses:
PortletWebRequest

public class PortletRequestAttributes
extends org.springframework.web.context.request.AbstractRequestAttributes

Portlet-based implementation of the RequestAttributes interface.

Accesses objects from portlet request and portlet session scope, with a distinction between "session" (the PortletSession's "portlet scope") and "global session" (the PortletSession's "application scope").

Since:
2.0
Author:
Juergen Hoeller
See Also:
PortletRequest.getAttribute(java.lang.String), PortletSession.getAttribute(java.lang.String), PortletSession.PORTLET_SCOPE, PortletSession.APPLICATION_SCOPE, RequestAttributes.SCOPE_SESSION, RequestAttributes.SCOPE_GLOBAL_SESSION

Field Summary
static java.lang.String DESTRUCTION_CALLBACK_NAME_PREFIX
          Constant identifying the String prefixed to the name of a destruction callback when it is stored in a PortletSession.
 
Fields inherited from class org.springframework.web.context.request.AbstractRequestAttributes
requestDestructionCallbacks
 
Fields inherited from interface org.springframework.web.context.request.RequestAttributes
REFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION
 
Constructor Summary
PortletRequestAttributes(javax.portlet.PortletRequest request)
          Create a new PortletRequestAttributes instance for the given request.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name, int scope)
           
 java.lang.String[] getAttributeNames(int scope)
           
 javax.portlet.PortletRequest getRequest()
          Exposes the native PortletRequest that we're wrapping.
protected  javax.portlet.PortletSession getSession(boolean allowCreate)
          Exposes the PortletSession that we're wrapping.
 java.lang.String getSessionId()
           
 java.lang.Object getSessionMutex()
           
 void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback, int scope)
           
protected  void registerSessionDestructionCallback(java.lang.String name, java.lang.Runnable callback)
          Register the given callback as to be executed after session termination.
 void removeAttribute(java.lang.String name, int scope)
           
 java.lang.Object resolveReference(java.lang.String key)
           
 void setAttribute(java.lang.String name, java.lang.Object value, int scope)
           
 java.lang.String toString()
           
protected  void updateAccessedSessionAttributes()
          Update all accessed session attributes through session.setAttribute calls, explicitly indicating to the container that they might have been modified.
 
Methods inherited from class org.springframework.web.context.request.AbstractRequestAttributes
isRequestActive, registerRequestDestructionCallback, removeRequestDestructionCallback, requestCompleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DESTRUCTION_CALLBACK_NAME_PREFIX

public static final java.lang.String DESTRUCTION_CALLBACK_NAME_PREFIX
Constant identifying the String prefixed to the name of a destruction callback when it is stored in a PortletSession.

Constructor Detail

PortletRequestAttributes

public PortletRequestAttributes(javax.portlet.PortletRequest request)
Create a new PortletRequestAttributes instance for the given request.

Parameters:
request - current portlet request
Method Detail

getRequest

public final javax.portlet.PortletRequest getRequest()
Exposes the native PortletRequest that we're wrapping.


getSession

protected final javax.portlet.PortletSession getSession(boolean allowCreate)
Exposes the PortletSession that we're wrapping.

Parameters:
allowCreate - whether to allow creation of a new session if none exists yet

getAttribute

public java.lang.Object getAttribute(java.lang.String name,
                                     int scope)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value,
                         int scope)

removeAttribute

public void removeAttribute(java.lang.String name,
                            int scope)

getAttributeNames

public java.lang.String[] getAttributeNames(int scope)

registerDestructionCallback

public void registerDestructionCallback(java.lang.String name,
                                        java.lang.Runnable callback,
                                        int scope)

resolveReference

public java.lang.Object resolveReference(java.lang.String key)

getSessionId

public java.lang.String getSessionId()

getSessionMutex

public java.lang.Object getSessionMutex()

updateAccessedSessionAttributes

protected void updateAccessedSessionAttributes()
Update all accessed session attributes through session.setAttribute calls, explicitly indicating to the container that they might have been modified.

Specified by:
updateAccessedSessionAttributes in class org.springframework.web.context.request.AbstractRequestAttributes

registerSessionDestructionCallback

protected void registerSessionDestructionCallback(java.lang.String name,
                                                  java.lang.Runnable callback)
Register the given callback as to be executed after session termination.

Note: The callback object should be serializable in order to survive web app restarts.

Parameters:
name - the name of the attribute to register the callback for
callback - the callback to be executed for destruction

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

spring-webmvc-portlet