【问题标题】:camel restlet component url matching骆驼restlet组件url匹配
【发布时间】:2014-10-30 13:37:30
【问题描述】:

我有以下骆驼路线

<camel:route>
        <camel:from uri="restlet:/foo/{bar}/model" />
        <camel:process ref="dummyProcessor" />
</camel:route>

我的问题是为什么我匹配这些请求(基本上我可以在模型后面放任何东西)

GET /foo/hoi/modelbroken

GET /foo/hoi/modelwhyisthisamatch

我希望这些应该返回 404。

我做错了什么?

【问题讨论】:

    标签: apache-camel restlet url-mapping


    【解决方案1】:

    Restlet 中有一个 Matching Mode 配置选项。

    http://restlet.com/learn/guide/2.3/core/routing/

    虽然指南说默认情况下它应该是 MODE_EQUALS,但如果您检查代码,它看起来就像是 Template.MODE_STARTS_WITH:

    https://github.com/restlet/restlet-framework-java/blob/master/modules/org.restlet/src/org/restlet/engine/component/InternalRouter.java

    不确定是指南还是源中的错误,但您可以自己配置。

    【讨论】:

    • 太好了,谢谢。现在的问题是如何配置camel中的restlet组件使用Template.MODE_EQUALS?
    • @ZoltanAltfatter 我在选项列表中看不到它,而且由于 Camel 对您隐藏了组件内部,我相信您唯一的选择是分叉组件,添加“matchingMode”参数并发送补丁。
    【解决方案2】:

    我也遇到过类似的情况,更新到 Java 11 和 camel 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-22
      • 1970-01-01
      • 1970-01-01
      • 2018-07-28
      • 2019-02-15
      相关资源
      最近更新 更多