【问题标题】:How to retrieve query parameter value while using Apache Camel?使用 Apache Camel 时如何检索查询参数值?
【发布时间】:2021-09-15 07:35:58
【问题描述】:

我有一个 REST 端点 http://localhost:8080/replaymessages/{messageids} 其中 messageids 将有逗号 (,) 分隔值 - 比如 123,456,789 等等。使用 Apache Camel 时如何检索这些值?

【问题讨论】:

    标签: java rest apache-camel spring-camel apache-camel-3


    【解决方案1】:

    您可以使用 bean 调用像 org.apache.commons.lang.StringUtils.split 这样的静态方法来拆分存储在标头中的路径参数: p>

    rest()
        .get("/replaymessages/{messageids}")
        .to("direct:processMessageIds");
    
    from("direct:processMessageIds")
        .bean(StringUtils.class, "split(${header.messageids}, ',' , -1)")
        .log(LoggingLevel.INFO, "id[0] == ${body[0]}");
    

    【讨论】:

      猜你喜欢
      • 2013-04-11
      • 2016-12-27
      • 1970-01-01
      • 2010-11-13
      • 2016-12-09
      • 1970-01-01
      • 2021-12-11
      • 1970-01-01
      • 2018-04-26
      相关资源
      最近更新 更多