com.liferay.faces.bridge.scope
Interface BridgeRequestScope

All Known Implementing Classes:
BridgeRequestScopeBaseImpl, BridgeRequestScopeCompat_2_2_Impl, BridgeRequestScopeCompatImpl, BridgeRequestScopeImpl, BridgeRequestScopeLiferayImpl

public interface BridgeRequestScope

Section 5.1.2 of the JSR 329 Spec describes a concept called the "bridge request scope," the purpose of which is to bridge the gap between the portlet lifecycle's ACTION_PHASE, EVENT_PHASE, and RENDER_PHASE. When the user invokes an HTTP POST operation by clicking on a Submit button, the portlet lifecycle's ACTION_PHASE will be invoked, and the bridge will execute all the phases of the JSF lifecycle except for RENDER_RESPONSE -- which is to be done later in the portlet lifecycle's RENDER_PHASE. The problem is that there might be things stored as request attributes like FacesMessage(s), and JSF Managed-Bean(s) during in the ACTION_PHASE, but also need to be referenced in the RENDER_PHASE. Technically, the ActionRequest created for the ACTION_PHASE and the RenderRequest created for the RENDER_PHASE are two different objects, and so the BridgeRequestScope exists to maintain request attribute values between the two phases.

Author:
Neil Griffin

Nested Class Summary
static class BridgeRequestScope.Transport
           
 
Method Summary
 Bridge.PortletPhase getBeganInPhase()
          Determines the Bridge#PortletPhase in which the bridge request scope instance was created.
 long getDateCreated()
          Returns the date in which the scope was created, measured in UTC milliseconds from the epoch.
 String getId()
          Returns the unique identifier, which is prefixed with the value passed to setIdPrefix(String).
 javax.portlet.PortletMode getPortletMode()
           
 Map<String,String> getPreservedActionParameterMap()
           
 String getPreservedViewStateParam()
           
 Set<String> getRemovedAttributeNames()
          This method returns a mutable set of attribute names that correspond to those that were removed by the removeExcludedAttributes(RenderRequest) method.
 boolean isFacesLifecycleExecuted()
          Returns the flag indicating whether or not the Faces Lifecycle was executed.
 boolean isNavigationOccurred()
          Returns the flag indicating whether or not a navigation-rule fired.
 boolean isPortletModeChanged()
          Returns a flag indicating whether or not the PortletMode has changed.
 boolean isRedirectOccurred()
          Returns a flag indicating whether or not a was encountered in a navigation-rule.
 void removeExcludedAttributes(javax.portlet.RenderRequest renderRequest)
          This method removes the excluded request attributes.
 void restoreState(javax.faces.context.FacesContext facesContext)
          This method restores the scoped data that was preserved by the call to saveState(FacesContext) method as required by section 5.1.2 of the Bridge Spec.
 void saveState(javax.faces.context.FacesContext facesContext)
          This method preserves the scoped data (as defined in Section 5.1.2 of the Bridge Spec).
 void setFacesLifecycleExecuted(boolean facesLifecycleExecuted)
          Sets the flag indicating whether or not the Faces lifecycle was executed.
 void setIdPrefix(String idPrefix)
          Sets the prefix of the unique identifier returned by getId().
 void setNavigationOccurred(boolean navigationOccurred)
          Sets the flag indicating whether or not a navigation-rule fired.
 void setPortletMode(javax.portlet.PortletMode portletMode)
           
 void setPortletModeChanged(boolean portletModeChanged)
          Sets a flag indicating whether or not the PortletMode has changed.
 void setRedirectOccurred(boolean redirectOccurred)
          Sets a flag indicating whether or not a was encountered in a navigation-rule.
 

Method Detail

removeExcludedAttributes

void removeExcludedAttributes(javax.portlet.RenderRequest renderRequest)
This method removes the excluded request attributes. It is designed to be called at the beginning of the RENDER_PHASE of the portlet lifecycle. However, it is only necessary to call this method if PortletContainer.isPostRedirectGetSupported() returns false. This is because portlet containers that do indeed implement the POST-REDIRECT-GET design pattern would not have any excluded request attributes carry-over from the ActionRequest to the RenderRequest.


restoreState

void restoreState(javax.faces.context.FacesContext facesContext)
This method restores the scoped data that was preserved by the call to saveState(FacesContext) method as required by section 5.1.2 of the Bridge Spec. This method is designed to be called during the EVENT_PHASE and RENDER_PHASE of the portlet lifecycle.

Parameters:
facesContext - The current FacesContext.

saveState

void saveState(javax.faces.context.FacesContext facesContext)
This method preserves the scoped data (as defined in Section 5.1.2 of the Bridge Spec). It should only be called during the PortletRequest.ACTION_PHASE and PortletRequest.EVENT_PHASE of the portlet lifecycle.

Parameters:
facesContext - The current FacesContext.

getBeganInPhase

Bridge.PortletPhase getBeganInPhase()
Determines the Bridge#PortletPhase in which the bridge request scope instance was created.

Returns:
The Bridge#PortletPhase in which the bridge request scope instance was created.

isFacesLifecycleExecuted

boolean isFacesLifecycleExecuted()
Returns the flag indicating whether or not the Faces Lifecycle was executed.

Returns:
true if the Faces Lifecycle was executed, otherwise false.

isNavigationOccurred

boolean isNavigationOccurred()
Returns the flag indicating whether or not a navigation-rule fired.

Returns:
true indicates that a navigation-rule fired, otherwise false.

isPortletModeChanged

boolean isPortletModeChanged()
Returns a flag indicating whether or not the PortletMode has changed.

Returns:
true if the portlet mode has changed, otherwise false

isRedirectOccurred

boolean isRedirectOccurred()
Returns a flag indicating whether or not a was encountered in a navigation-rule.

Returns:
true indicates that was encountered in a navigation-rule, otherwise false.

getDateCreated

long getDateCreated()
Returns the date in which the scope was created, measured in UTC milliseconds from the epoch.


setFacesLifecycleExecuted

void setFacesLifecycleExecuted(boolean facesLifecycleExecuted)
Sets the flag indicating whether or not the Faces lifecycle was executed.

Parameters:
facesLifecycleExecuted - true indicates that the Faces lifecycle was executed, otherwise false.

getId

String getId()
Returns the unique identifier, which is prefixed with the value passed to setIdPrefix(String).


setIdPrefix

void setIdPrefix(String idPrefix)
Sets the prefix of the unique identifier returned by getId().


setNavigationOccurred

void setNavigationOccurred(boolean navigationOccurred)
Sets the flag indicating whether or not a navigation-rule fired.

Parameters:
navigationOccurred - true indicates that a navigation-rule fired, otherwise false.

getPortletMode

javax.portlet.PortletMode getPortletMode()

setPortletMode

void setPortletMode(javax.portlet.PortletMode portletMode)

setPortletModeChanged

void setPortletModeChanged(boolean portletModeChanged)
Sets a flag indicating whether or not the PortletMode has changed. If true then request attributes will not be preserved when the saveState(FacesContext) method is called.


getPreservedActionParameterMap

Map<String,String> getPreservedActionParameterMap()

getPreservedViewStateParam

String getPreservedViewStateParam()

setRedirectOccurred

void setRedirectOccurred(boolean redirectOccurred)
Sets a flag indicating whether or not a was encountered in a navigation-rule.

Parameters:
redirectOccurred - true indicates that a was encountered in a navigation-rule, otherwise false.

getRemovedAttributeNames

Set<String> getRemovedAttributeNames()
This method returns a mutable set of attribute names that correspond to those that were removed by the removeExcludedAttributes(RenderRequest) method. Since the return value is mutable, callers of this method have an opportunity to add names to the set when necessary.

Returns:
The set of removed attribute names.


Copyright © 2014 Liferay, Inc.. All Rights Reserved.