【问题标题】:Camel exception before reaching route到达路线前的骆驼异常
【发布时间】:2019-05-22 04:22:01
【问题描述】:

我有如下的休息路线

from("restlet:/api?restletMethod=GET").log("API Reached");

问题是from("restlet:/api?restletMethod=GET") 在我发送像http://localhost:8080/api?query=%s%n%s 这样的无效网址时抛出异常。

如何处理这个异常? onException 不工作,因为请求没有到达路由

【问题讨论】:

  • 你应该做 from("restlet:localhost:8080/api").你得到什么异常,你使用什么版本的骆驼
  • 另外 onException 是针对路由期间的异常,而不是事先。但是一些组件可以支持桥接错误处理,请参阅文档或我的书了解更多详细信息。

标签: exception apache-camel restlet


【解决方案1】:

我相信你应该像这样配置端点。

RestletEndpoint endpoint = context.getEndpoint("restlet:http://localhost:8080/api", RestletEndpoint.class);
endpoint.configureProperties(Collections.singletonMap("bridgeErrorHandler", true));

【讨论】:

    猜你喜欢
    • 2023-04-06
    • 2013-08-13
    • 2020-05-13
    • 2018-09-05
    • 1970-01-01
    • 2018-08-15
    • 1970-01-01
    • 2012-04-02
    • 2011-05-24
    相关资源
    最近更新 更多