|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.webflow.executor.jsf.FlowPhaseListener
public class FlowPhaseListener
JSF phase listener responsible for managing the FlowExecution
object lifecycle in a JSF environment. This
class handles restoring and saving a FlowExecution so other JSF artifacts that execute in different phases of the JSF
lifecycle may access conversational state and utilize Web Flow navigation behavior.
A restored flow execution is placed in a holder that other JSF artifacts such as VariableResolvers, PropertyResolvers and NavigationHandlers may access during the request lifecycle. Once in the holder the execution is considered "restored" and referred to as the "current" flow execution for this request.
This phase listener implements the following algorithm:
FlowExecution
if a call to
FlowExecutorArgumentHandler.extractFlowExecutionKey(ExternalContext)
returns a valid flow execution key. This
occurs when a flow execution redirect or browser refresh is issued and ultimately results in a flow execution
refresh.
FlowExecution
if a call to
FlowExecutorArgumentHandler.extractFlowId(ExternalContext)
returns a valid flow id. This occurs when a
browser accesses a flow definition URL directly and is used to launch a new flow execution.
state holder component
will restore the current
FlowExecution if it is present in the JSF ViewRoot. This occurs when a postback from a JSF view that is participating
in a flow.
FlowExecutionRepository
. Expose the new flow
execution key as a component in the view root for restoration on the next request.
DelegatingPhaseListenerMulticaster
when you
need to customize a FlowPhaseListener instance.
Nested Class Summary | |
---|---|
static class |
FlowPhaseListener.DefaultViewIdMapper
Standard default view id resolver which uses the web flow view name as the jsf view id |
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
Logger, usable by subclasses. |
Constructor Summary | |
---|---|
FlowPhaseListener()
|
Method Summary | |
---|---|
void |
afterPhase(javax.faces.event.PhaseEvent event)
|
void |
beforePhase(javax.faces.event.PhaseEvent event)
|
protected FlowExecutionKeyStateHolder |
createFlowExecutionKeyStateHolder()
Factory method that creates the state holder UI component that will track the flow execution key used for execution restoration during subsequent restore view phases. |
protected MutableAttributeMap |
createInput(ExternalContext context)
Factory method that creates the input attribute map for a newly created FlowExecution . |
FlowExecutorArgumentHandler |
getArgumentHandler()
Returns the argument handler used by this phase listener. |
org.springframework.binding.mapping.AttributeMapper |
getInputMapper()
Returns the configured flow execution input mapper. |
javax.faces.event.PhaseId |
getPhaseId()
|
ViewIdMapper |
getViewIdMapper()
Returns the JSF view id resolver used by this phase listener. |
protected void |
handleFlowExecutionAccessException(FlowExecutionAccessException e,
javax.faces.context.FacesContext context)
Hook method to handle a thrown flow execution access exception. |
protected void |
prepareApplicationView(javax.faces.context.FacesContext facesContext,
FlowExecutionHolder holder)
Prepare the JSF view for rendering. |
protected void |
prepareResponse(JsfExternalContext context,
FlowExecutionHolder holder)
Prepare the appropriate JSF response (e.g. |
protected void |
restoreFlowExecution(javax.faces.context.FacesContext facesContext)
|
protected void |
saveFlowExecution(JsfExternalContext context,
FlowExecutionHolder holder)
Updates the current flow execution in the repository. |
protected void |
sendRedirect(java.lang.String url,
javax.faces.context.FacesContext context)
Helper method to issue a redirect in a JSF environment properly. |
void |
setArgumentHandler(FlowExecutorArgumentHandler argumentHandler)
Sets the handler for arguments needed by this phase listener to restore and launch flow executions. |
void |
setInputMapper(org.springframework.binding.mapping.AttributeMapper inputMapper)
Sets the service responsible for mapping attributes of an ExternalContext to a new FlowExecution
during a launch flow operation. |
void |
setViewIdMapper(ViewIdMapper viewIdMapper)
Sets the JSF view id mapper used by this phase listener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public FlowPhaseListener()
Method Detail |
---|
public FlowExecutorArgumentHandler getArgumentHandler()
public void setArgumentHandler(FlowExecutorArgumentHandler argumentHandler)
argumentHandler
- the argument handlerpublic org.springframework.binding.mapping.AttributeMapper getInputMapper()
public void setInputMapper(org.springframework.binding.mapping.AttributeMapper inputMapper)
ExternalContext
to a new FlowExecution
during a launch flow operation. The default implementation simply exposes all request parameters as flow
execution input attributes. May be null.
inputMapper
- the input mapperRequestParameterInputMapper
public ViewIdMapper getViewIdMapper()
public void setViewIdMapper(ViewIdMapper viewIdMapper)
FlowPhaseListener.DefaultViewIdMapper
provides a mechanism to convert
a logical Spring Web Flow application view name into a JSF view id.ViewHandler
.FlowPhaseListener.DefaultViewIdMapper
provides the ability to customize how SWF view name is mapped to a JSF view id that will
be passed to the ViewHandler. The default value for the view id mapper is a FlowPhaseListener.DefaultViewIdMapper
which
just returns the SWF viewId as-is.
viewIdMapper
- the view id mapperprepareApplicationView(FacesContext, FlowExecutionHolder)
public javax.faces.event.PhaseId getPhaseId()
getPhaseId
in interface javax.faces.event.PhaseListener
public void beforePhase(javax.faces.event.PhaseEvent event)
beforePhase
in interface javax.faces.event.PhaseListener
public void afterPhase(javax.faces.event.PhaseEvent event)
afterPhase
in interface javax.faces.event.PhaseListener
protected void restoreFlowExecution(javax.faces.context.FacesContext facesContext)
protected void handleFlowExecutionAccessException(FlowExecutionAccessException e, javax.faces.context.FacesContext context)
e
- the flow execution access exceptioncontext
- the current faces contextprotected MutableAttributeMap createInput(ExternalContext context)
FlowExecution
. This
implementation uses the registered input mapper, if any.
context
- the external context
protected void prepareResponse(JsfExternalContext context, FlowExecutionHolder holder)
context
- the contextholder
- the holderprotected void prepareApplicationView(javax.faces.context.FacesContext facesContext, FlowExecutionHolder holder)
facesContext
- the faces contextholder
- the holder of the current flow executionprotected FlowExecutionKeyStateHolder createFlowExecutionKeyStateHolder()
saveInViewRoot(FacesContext, String)
protected void saveFlowExecution(JsfExternalContext context, FlowExecutionHolder holder)
context
- the external contextholder
- the current flow execution holderprotected void sendRedirect(java.lang.String url, javax.faces.context.FacesContext context)
url
- the url to redirect tocontext
- the faces context
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |