org.springframework.webflow.action
Class AbstractAction

java.lang.Object
  extended by org.springframework.webflow.action.AbstractAction
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, Action
Direct Known Subclasses:
CompositeAction, EvaluateAction, ExternalRedirectAction, FlowDefinitionRedirectAction, MultiAction, RenderAction, SetAction, ViewFactoryActionAdapter

public abstract class AbstractAction
extends Object
implements Action, org.springframework.beans.factory.InitializingBean

Base action that provides assistance commonly needed by action implementations. This includes:

Author:
Keith Donald, Erwin Vervaet

Constructor Summary
AbstractAction()
           
 
Method Summary
 void afterPropertiesSet()
           
 Event execute(RequestContext context)
          Execute this action.
 EventFactorySupport getEventFactorySupport()
          Returns the helper delegate for creating action execution result events.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAction

public AbstractAction()
Method Detail

getEventFactorySupport

public EventFactorySupport getEventFactorySupport()
Returns the helper delegate for creating action execution result events.

Returns:
the event factory support

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

execute

public final Event execute(RequestContext context)
                    throws Exception
Description copied from interface: Action
Execute this action. Action execution will occur in the context of a request associated with an active flow execution.

Action invocation is typically triggered in a production environment by a state within a flow carrying out the execution of a flow definition. The result of action execution, a logical outcome event, can be used as grounds for a transition out of the calling state.

Note: The RequestContext argument to this method provides access to data about the active flow execution in the context of the currently executing thread. Among other things, this allows this action to access data set by other actions, as well as set its own attributes it wishes to expose in a given scope.

Some notes about actions and their usage of the attribute scope types:

All attributes present in any scope are typically exposed in a model for access by a view when an "interactive" state type such as a view state is entered.

Note: flow scope should generally not be used as a general purpose cache, but rather as a context for data needed locally by other states of the flow this action participates in. For example, it would be inappropriate to stuff large collections of objects (like those returned to support a search results view) into flow scope. Instead, put such result collections in request scope, and ensure you execute this action again each time you wish to view those results. 2nd level caches managed outside of SWF are more general cache solutions.

Note: as flow scoped attributes are eligible for serialization they should be Serializable.

Specified by:
execute in interface Action
Parameters:
context - the action execution context, for accessing and setting data in a scope type, as well as obtaining other flow contextual information (e.g. request context attributes and flow execution context information)
Returns:
a logical result outcome, used as grounds for a transition in the calling flow (e.g. "success", "error", "yes", "no", * ...)
Throws:
Exception - a exception occurred during action execution, either checked or unchecked; note, any recoverable exceptions should be caught within this method and an appropriate result outcome returned or be handled by the current state of the calling flow execution.