public class PortletRequestAttributes
extends org.springframework.web.context.request.AbstractRequestAttributes
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").
PortletRequest.getAttribute(java.lang.String)
,
PortletSession.getAttribute(java.lang.String)
,
PortletSession.PORTLET_SCOPE
,
PortletSession.APPLICATION_SCOPE
,
RequestAttributes.SCOPE_SESSION
,
RequestAttributes.SCOPE_GLOBAL_SESSION
Modifier and Type | Field and Description |
---|---|
static 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 and Description |
---|
PortletRequestAttributes(PortletRequest request)
Create a new PortletRequestAttributes instance for the given request.
|
PortletRequestAttributes(PortletRequest request,
PortletResponse response)
Create a new PortletRequestAttributes instance for the given request.
|
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String name,
int scope) |
String[] |
getAttributeNames(int scope) |
PortletRequest |
getRequest()
Exposes the native
PortletRequest that we're wrapping. |
PortletResponse |
getResponse()
Exposes the native
PortletResponse that we're wrapping (if any). |
protected PortletSession |
getSession(boolean allowCreate)
Exposes the
PortletSession that we're wrapping. |
String |
getSessionId() |
Object |
getSessionMutex() |
void |
registerDestructionCallback(String name,
Runnable callback,
int scope) |
protected void |
registerSessionDestructionCallback(String name,
Runnable callback)
Register the given callback as to be executed after session termination.
|
void |
removeAttribute(String name,
int scope) |
Object |
resolveReference(String key) |
void |
setAttribute(String name,
Object value,
int scope) |
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. |
public static final String DESTRUCTION_CALLBACK_NAME_PREFIX
String
prefixed to the name of a
destruction callback when it is stored in a PortletSession
.public PortletRequestAttributes(PortletRequest request)
request
- current portlet requestpublic PortletRequestAttributes(PortletRequest request, PortletResponse response)
request
- current portlet requestresponse
- current portlet response (for optional exposure)public final PortletRequest getRequest()
PortletRequest
that we're wrapping.public final PortletResponse getResponse()
PortletResponse
that we're wrapping (if any).protected final PortletSession getSession(boolean allowCreate)
PortletSession
that we're wrapping.allowCreate
- whether to allow creation of a new session if none exists yetpublic void removeAttribute(String name, int scope)
public String[] getAttributeNames(int scope)
public void registerDestructionCallback(String name, Runnable callback, int scope)
public String getSessionId()
public Object getSessionMutex()
protected void updateAccessedSessionAttributes()
session.setAttribute
calls, explicitly indicating to the container that they might have been modified.updateAccessedSessionAttributes
in class org.springframework.web.context.request.AbstractRequestAttributes
protected void registerSessionDestructionCallback(String name, Runnable callback)
Note: The callback object should be serializable in order to survive web app restarts.
name
- the name of the attribute to register the callback forcallback
- the callback to be executed for destruction