Camel HTTP端点Special Charcter(+)问题

时间:2015-06-08 16:21:18

标签: apache-camel

我遇到通过camel recipientlist(2.14)点击http终点的问题。

<route id="httpexecutor">
        <from uri="direct:httpexecutor" />
        <process ref="httpPreprocessor" />
        <recipientList>
            <simple>${property[inputSearchParameter.url]}</simple>
        </recipientList>
</route>

当网址有一个+号(在其中一个参数中)时,它就会破坏。 我也尝试了%2B然后它被转换为空间。

有一个JIRA: https://issues.apache.org/jira/browse/CAMEL-6176

然而,当我使用RAW时,它无法工作并获得以下跟踪(似乎RAW被传递给服务):

Caused by: java.net.URISyntaxException: Illegal character in query at index 558: http://someurl?facet=true&binary=true&-fq=nm_task_type%3A%28OTM_QUERY+OR+OTM_CLIENT_QUERY%29&facet.query=%7B%21key%3D%22%5B*+TO+NOW-30%5D%22%7Ddt_created%3A%5B*+TO+NOW-30DAY%5D&facet.query=%7B%21key%3D%22%5BNOW-30DAY+TO+NOW-15DAY%5D%22%7Ddt_created%3A%5BNOW-30DAY+TO+NOW-15DAY%5D&facet.query=%7B%21key%3D%22%5BNOW-15DAY+TO+NOW-7DAY%5D%22%7Ddt_created%3A%5BNOW-15DAY+TO+NOW-7DAY%5D&facet.query=%7B%21key%3D%22%5BNOW-7DAY+TO+NOW-1DAY%5D%22%7Ddt_created%3A%5BNOW-7DAY+TO+NOW-1DAY%5D&facet.query=RAW({!key="[NOW-1DAY TO NOW]"}dt_created:[NOW-1DAY TO NOW+1DAY])&q=*%3A*&rows=0
    at java.net.URI$Parser.fail(URI.java:2829)
    at java.net.URI$Parser.checkChars(URI.java:3002)
    at java.net.URI$Parser.parseHierarchical(URI.java:3092)
    at java.net.URI$Parser.parse(URI.java:3034)
    at java.net.URI.<init>(URI.java:595)
    at org.apache.camel.util.URISupport.createURIWithQuery(URISupport.java:334)
    at org.apache.camel.util.URISupport.createRemainingURI(URISupport.java:428)
    at org.apache.camel.component.http.HttpComponent.createEndpoint(HttpComponent.java:248)
    at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:122)
    at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:525)
    ... 52 more

任何有用的帮助。

1 个答案:

答案 0 :(得分:1)

我还没有测试过这个,但是你可以设置标题&#34; CamelHttpPath&#34;在传递给Camel HTTP组件之前访问您的URL并查看它是否有帮助:

<setHeader headerName="CamelHttpPath">
  <simple>YOUR_URL</simple>
</setHeader>