public class PortletRequestAttributes extends 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| 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. |
static int |
SCOPE_GLOBAL_SESSION
Constant that indicates global session scope.
|
requestDestructionCallbacksREFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_REQUEST, SCOPE_SESSION| Constructor and Description |
|---|
PortletRequestAttributes(javax.portlet.PortletRequest request)
Create a new PortletRequestAttributes instance for the given request.
|
PortletRequestAttributes(javax.portlet.PortletRequest request,
javax.portlet.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) |
javax.portlet.PortletRequest |
getRequest()
Exposes the native
PortletRequest that we're wrapping. |
javax.portlet.PortletResponse |
getResponse()
Exposes the native
PortletResponse that we're wrapping (if any). |
protected javax.portlet.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. |
isRequestActive, registerRequestDestructionCallback, removeRequestDestructionCallback, requestCompletedpublic static final String DESTRUCTION_CALLBACK_NAME_PREFIX
String prefixed to the name of a destruction callback when it is stored in a
PortletSession.public static final int SCOPE_GLOBAL_SESSION
This explicitly refers to a globally shared session, (a.k.a. PortletSession.APPLICATION_SCOPE) Else, it simply refers to the common session.
public PortletRequestAttributes(javax.portlet.PortletRequest request)
request - current portlet requestpublic PortletRequestAttributes(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response)
request - current portlet requestresponse - current portlet response (for optional exposure)public String[] getAttributeNames(int scope)
public final javax.portlet.PortletRequest getRequest()
PortletRequest that we're wrapping.public final javax.portlet.PortletResponse getResponse()
PortletResponse that we're wrapping (if any).public String getSessionId()
public Object getSessionMutex()
public void registerDestructionCallback(String name, Runnable callback, int scope)
public void removeAttribute(String name, int scope)
protected final javax.portlet.PortletSession getSession(boolean allowCreate)
PortletSession that we're wrapping.allowCreate - whether to allow creation of a new session if none exists yetprotected 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 destructionprotected void updateAccessedSessionAttributes()
session.setAttribute calls, explicitly indicating to the
container that they might have been modified.updateAccessedSessionAttributes in class AbstractRequestAttributesCopyright © 2019 Liferay, Inc.. All rights reserved.