Expert Spring MVC and Web Flow

(Dana P.) #1
Table 12-13.Spring Web Flow State Exceptions
Class Description Thrown By
org.springframework. Common base class for This is a convenience
webflow.StateException all state exceptions. class and is not thrown.
org.springframework.webflow. Indicates an exception ActionExecutor.execute
ActionExecutionException (checked or runtime) was
thrown by an action. The
exception may be from
the action itself, or it may
be an exception thrown by
the target of the action (e.g.,
your business method).
org.springframework.webflow. Indicates that the requested FlowExecutionListener.
execution.EnterStateVetoException state cannot be entered sessionStartingand
because of a constraint FlowExecutionListener.
violation. stateEntering.
org.springframework.webflow. Thrown if there are no TransitionableState.
NoMatchingTransitionException matching transitions that getRequiredTransition.
match the signaled event
in the current state.
org.springframework.webflow. Thrown if a request to FlowExecutionRepository
execution.repository. resume an execution implementations when
NoSuchConversationException of a flow references a loading a conversation.
conversation that is
invalid (i.e., a nonexistent
conversation or an expired
conversation).
org.springframework.webflow. Thrown if a request to FlowExecutionRepository
execution.repository. resume an execution of a implementations when
InvalidConversationContinuationException flow references an invalid loading a continuation.
continuation (e.g., a
nonexistent continuation
or a continuation that
has expired).

The default behavior is for Spring Web Flow to allow unhandled exceptions to trickle out
of the flow and up the call stack, eventually to be handled by the calling web framework or
ultimately the application container.
Spring Web Flow provides a default implementation of StateExceptionHandler: org.
springframework.webflow.support.TransitionExecutingStateExceptionHandler, which
allows you to catch an occurrence of a type of Exceptionand execute a transition to a error
state. So for example, if you decided that you wanted to display a specific error page for
DuplicatePurchaseExceptionexceptions, you would modify your web flow definition to
include <exception-handler class="purchase.domain.DuplicatePurchaseException"
state="error"/>.
Whenever purchase.domain.DuplicatePurchaseExceptionis thrown, this definition
fragment instructs the flow to transition to the specified target state (error), which in this
case would result in an error view being displayed.

368 CHAPTER 12 ■ADVANCED SPRING WEB FLOW

Free download pdf