public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHandlerAdvice
MessageHandlers.
Two expressions 'onSuccessExpression' and 'onFailureExpression' are evaluated when
appropriate. If the evaluation returns a result, a message is sent to the onSuccessChannel
or onFailureChannel as appropriate; the message is the input message with a header
MessageHeaders.POSTPROCESS_RESULT containing the evaluation result.
The failure expression is NOT evaluated if the success expression throws an exception.| Modifier and Type | Class and Description |
|---|---|
static class |
ExpressionEvaluatingRequestHandlerAdvice.MessageHandlingExpressionEvaluatingAdviceException |
AbstractRequestHandlerAdvice.ExecutionCallbacklogger| Constructor and Description |
|---|
ExpressionEvaluatingRequestHandlerAdvice() |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.expression.spel.support.StandardEvaluationContext |
createEvaluationContext() |
protected java.lang.Object |
doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback,
java.lang.Object target,
Message<?> message)
Subclasses implement this method to apply behavior to the
MessageHandler. |
void |
setFailureChannel(MessageChannel failureChannel) |
void |
setOnFailureExpression(java.lang.String onFailureExpression) |
void |
setOnSuccessExpression(java.lang.String onSuccessExpression) |
void |
setPropagateEvaluationFailures(boolean propagateOnSuccessEvaluationFailures)
If true and an onSuccess expression evaluation fails with an exception, the exception will be thrown to the
caller.
|
void |
setReturnFailureExpressionResult(boolean returnFailureExpressionResult)
If true, the result of evaluating the onFailureExpression will
be returned as the result of AbstractReplyProducingMessageHandler.handleRequestMessage(Message).
|
void |
setSuccessChannel(MessageChannel successChannel) |
void |
setTrapException(boolean trapException)
If true, any exception will be caught and null returned.
|
invoke, unwrapExceptionIfNecessary, unwrapThrowableIfNecessaryafterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getComponentType, getConversionService, getIntegrationProperties, getIntegrationProperty, getTaskScheduler, onInit, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toStringpublic ExpressionEvaluatingRequestHandlerAdvice()
public void setOnSuccessExpression(java.lang.String onSuccessExpression)
public void setOnFailureExpression(java.lang.String onFailureExpression)
public void setSuccessChannel(MessageChannel successChannel)
public void setFailureChannel(MessageChannel failureChannel)
public void setTrapException(boolean trapException)
trapException - public void setReturnFailureExpressionResult(boolean returnFailureExpressionResult)
returnFailureExpressionResult - public void setPropagateEvaluationFailures(boolean propagateOnSuccessEvaluationFailures)
propagateOnSuccessEvaluationFailures - protected java.lang.Object doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, java.lang.Object target, Message<?> message) throws java.lang.Exception
AbstractRequestHandlerAdviceMessageHandler.
callback.execute() invokes the handler method and returns its result, or null.
doInvoke in class AbstractRequestHandlerAdvicecallback - Subclasses invoke the execute() method on this interface to invoke the handler method.target - The target handler.message - The message that will be sent to the handler.MessageHandler.java.lang.Exceptionprotected org.springframework.expression.spel.support.StandardEvaluationContext createEvaluationContext()