public class TransitionExecutingFlowExecutionExceptionHandler extends java.lang.Object implements FlowExecutionExceptionHandler
State
.
The handled FlowExecutionException
will be exposed in flash scope as
FLOW_EXECUTION_EXCEPTION_ATTRIBUTE
. The underlying root cause of that exception will be exposed in flash
scope as ROOT_CAUSE_EXCEPTION_ATTRIBUTE
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FLOW_EXECUTION_EXCEPTION_ATTRIBUTE
The name of the attribute to expose a handled exception under in flash scope ("flowExecutionException").
|
static java.lang.String |
ROOT_CAUSE_EXCEPTION_ATTRIBUTE
The name of the attribute to expose a root cause of a handled exception under in flash scope
("rootCauseException").
|
Constructor and Description |
---|
TransitionExecutingFlowExecutionExceptionHandler() |
Modifier and Type | Method and Description |
---|---|
TransitionExecutingFlowExecutionExceptionHandler |
add(java.lang.Class<? extends java.lang.Throwable> exceptionClass,
java.lang.String targetStateId)
Adds an exception-to-target state mapping to this handler.
|
TransitionExecutingFlowExecutionExceptionHandler |
add(java.lang.Class<? extends java.lang.Throwable> exceptionClass,
TargetStateResolver targetStateResolver)
Adds a exception-to-target state resolver mapping to this handler.
|
boolean |
canHandle(FlowExecutionException e)
Can this handler handle the given exception?
|
protected void |
exposeException(RequestContext context,
FlowExecutionException exception,
java.lang.Throwable rootCause)
Exposes the given flow exception and root cause in flash scope to make them available for response rendering.
|
ActionList |
getActionList()
Returns the list of actions to execute when this handler handles an exception.
|
protected TargetStateResolver |
getTargetStateResolver(java.lang.Throwable e)
Find the mapped target state resolver for given exception.
|
void |
handle(FlowExecutionException exception,
RequestControlContext context)
Handle the exception in the context of the current request.
|
java.lang.String |
toString() |
public static final java.lang.String FLOW_EXECUTION_EXCEPTION_ATTRIBUTE
public static final java.lang.String ROOT_CAUSE_EXCEPTION_ATTRIBUTE
public TransitionExecutingFlowExecutionExceptionHandler()
public TransitionExecutingFlowExecutionExceptionHandler add(java.lang.Class<? extends java.lang.Throwable> exceptionClass, java.lang.String targetStateId)
exceptionClass
- the type of exception to maptargetStateId
- the id of the state to transition to if the specified type of exception is handledpublic TransitionExecutingFlowExecutionExceptionHandler add(java.lang.Class<? extends java.lang.Throwable> exceptionClass, TargetStateResolver targetStateResolver)
exceptionClass
- the type of exception to maptargetStateResolver
- the resolver to calculate the state to transition to if the specified type of
exception is handledpublic ActionList getActionList()
public boolean canHandle(FlowExecutionException e)
FlowExecutionExceptionHandler
canHandle
in interface FlowExecutionExceptionHandler
e
- the exception that occurredpublic void handle(FlowExecutionException exception, RequestControlContext context)
FlowExecutionExceptionHandler
RequestControlContext.execute(Transition)
.handle
in interface FlowExecutionExceptionHandler
exception
- the exception that occurredcontext
- the execution control context for this requestprotected void exposeException(RequestContext context, FlowExecutionException exception, java.lang.Throwable rootCause)
context
- the request control contextexception
- the exception being handledrootCause
- root cause of the exception being handled (could be null)protected TargetStateResolver getTargetStateResolver(java.lang.Throwable e)
null
if no mapping can be found
for given exception. Will try all exceptions in the exception cause chain.public java.lang.String toString()
toString
in class java.lang.Object