【发布时间】:2013-03-16 03:19:34
【问题描述】:
我有一个包裹在 mule v3.2.1 流中的 JAX-RS 服务,它可能会触发我想要捕获和处理的异常。我更愿意将异常发送到另一个类并返回一个 HTTP 状态为 500 的 OutboundProperty。这是我目前所得到的:
<flow name="someFlow">
<...do some stuff...>
<custom-exception-strategy class="com.myCustomExceptionHandler>
</default-exception-strategy>
</flow>
myCustomExceptionHandler.handleException() 在我触发异常时永远不会被调用。我不清楚如何重新打包 mule 消息以返回 http 响应。
谁能提供一些关于如何让它工作的想法?
----更新----
异常将是 org.mule.api.expression.RequiredValueException,在自定义消息处理器中的 MuleExpressionManager 实例调用 evaluate() 时抛出该异常:
public class RequestCheckWithAppMessageProcessor
implements FlowConstructAware, MuleContextAware, Disposable, Initialisable, Startable, Stoppable, MessageProcessor
myCustomExceptionHandler 类扩展了 AbstractMessagingExceptionStrategy。
【问题讨论】:
标签: java rest exception-handling jax-rs mule