Mule格式错误的端点错误

时间:2014-04-22 09:11:28

标签: java http rest mule mule-el

我是Mule的新手并尝试使用HTTP端点发布GET请求,但我收到以下错误

“模板端点”http://api.mymemory.translated.net:80/get?q=#[message.inboundProperties.get('http.relative.path')]& langpair = EN | IT“已解析为格式错误的端点”http://api.mymemory.translated.net:80/get?q=hello&langpair=EN|IT“。无法通过端点路由事件: org.mule.endpoint.DynamicOutboundEndpoint“

我尝试了以下配置:

get?q=hello&langpair=EN%7CIT [工作]

get?q=#[message.inboundProperties.get('http.relative.path')]&langpair=EN%7CIT [不工作]

get?q=#[message.inboundProperties.get('http.relative.path')]&langpair=EN|IT  [不工作]

堆栈跟踪似乎表明“|”存在问题字符。

我的流程如下:

<flow name="my_first_projectFlow1" doc:name="my_first_projectFlow1"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/> <http:outbound-endpoint exchange-pattern="request-response" host="api.mymemory.translated.net" port="80" path="get?q=#[message.inboundProperties.get('http.relative.path')]&amp;langpair=EN%7CIT" method="GET" doc:name="HTTP"/> <echo-component doc:name="Echo"/> </flow>

1 个答案:

答案 0 :(得分:0)

尝试用MEL表达式#[java.net.URLEncoder.encode('|', 'UTF-8')]替换管道(“|”)char。

相关问题