Spring Web Flow

org.springframework.webflow.mvc.portlet
Interface FlowHandler

All Known Implementing Classes:
AbstractFlowHandler

public interface FlowHandler

A controller helper used for customizing access to a single flow definition in a Portlet environment. This helper is used to:

  1. Launch executions of that flow with data in the execution input map
  2. Handle outcomes reached by that flow in a custom manner
  3. Handle unhandled exceptions dealing with that flow in a custom manner
Such a handler can be visually thought of as a "flow reference" on a Garrett IA diagram. It holds a reference to the flow id to launch, how to provision its input, how to process its outcomes, and how to handle uncaught exceptions.

Author:
Keith Donald, Rossen Stoyanchev

Method Summary
 MutableAttributeMap<java.lang.Object> createExecutionInputMap(javax.portlet.RenderRequest request)
          Creates the flow execution input map to pass to a new instance of the flow being started in a render request.
 MutableAttributeMap<java.lang.Object> createResourceExecutionInputMap(javax.portlet.ResourceRequest request)
          Creates the flow execution input map to pass to a new instance of the flow being started in a resource request.
 java.lang.String getFlowId()
          Returns the id of the flow handled by this handler.
 java.lang.String handleException(FlowException e, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Handles a flow exception that was not handled by the Web Flow system in render request.
 boolean handleExecutionOutcome(FlowExecutionOutcome outcome, javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
          Handles a specific flow execution outcome.
 java.lang.String handleResourceException(FlowException e, javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response)
          Handles a flow exception that was not handled by the Web Flow system in a resource request.
 

Method Detail

getFlowId

java.lang.String getFlowId()
Returns the id of the flow handled by this handler. Used by a Controller to load the flow definition.

Returns:
the flow id

createExecutionInputMap

MutableAttributeMap<java.lang.Object> createExecutionInputMap(javax.portlet.RenderRequest request)
Creates the flow execution input map to pass to a new instance of the flow being started in a render request. Used by a Controller to launch the flow execution with the correct input.

Parameters:
request - the current request
Returns:
the input map

createResourceExecutionInputMap

MutableAttributeMap<java.lang.Object> createResourceExecutionInputMap(javax.portlet.ResourceRequest request)
Creates the flow execution input map to pass to a new instance of the flow being started in a resource request. Used by a Controller to launch the flow execution with the correct input.

Parameters:
request - the current request
Returns:
the input map

handleExecutionOutcome

boolean handleExecutionOutcome(FlowExecutionOutcome outcome,
                               javax.portlet.ActionRequest request,
                               javax.portlet.ActionResponse response)
                               throws javax.portlet.PortletModeException
Handles a specific flow execution outcome. Used to change portlet modes after the flow ends.

Parameters:
outcome - the outcome that was reached
request - the current action request
response - the current action response
Returns:
whether this outcome was handled, or whether the caller should handle it
Throws:
javax.portlet.PortletModeException - if this handler tries to change the portlet mode to something invalid

handleException

java.lang.String handleException(FlowException e,
                                 javax.portlet.RenderRequest request,
                                 javax.portlet.RenderResponse response)
Handles a flow exception that was not handled by the Web Flow system in render request. Used by a Controller to handle a specific type of exception dealing with this flow in a custom manner.

Parameters:
e - the unhandled exception originating from Spring Web Flow. May be thrown by the flow execution itself or the flow executor system if no execution could be restored.
request - the current request
response - the current response
Returns:
the name of a specific error view to render, or null if the exception should be handled by the caller

handleResourceException

java.lang.String handleResourceException(FlowException e,
                                         javax.portlet.ResourceRequest request,
                                         javax.portlet.ResourceResponse response)
Handles a flow exception that was not handled by the Web Flow system in a resource request. Used by a Controller to handle a specific type of exception dealing with this flow in a custom manner.

Parameters:
e - the unhandled exception originating from Spring Web Flow. May be thrown by the flow execution itself or the flow executor system if no execution could be restored.
request - the current request
response - the current response
Returns:
the name of a specific error view to render, or null if the exception should be handled by the caller

Spring Web Flow