【发布时间】:2012-11-09 11:29:02
【问题描述】:
为了将http请求发送到基于消息头的动态url...
我正在尝试将消息头中的 url 值设置如下:
<int-http:outbound-gateway id="httpOutboundGateway" request-channel="fromMyQueue"
url="{outboundGatewayUrl}" reply-channel="nullChannel"
http-method="POST" expected-response-type="java.lang.String" charset="UTF-8">
<int-http:uri-variable name="outboundGatewayUrl" expression="headers['X-CUSTOM-HTTP-REQUEST-URL']" />
但这不起作用。
显然{outboundGatewayUrl} 值根本没有被替换。
如果我将 {outboundGatewayUrl} 替换为实际 URL,则此方法有效。
错误信息:
Caused by:
org.springframework.integration.MessageHandlingException: HTTP request execution failed for URI [{outboundGatewayUrl}]...
Caused by:<br> java.lang.IllegalArgumentException: URI is not absolute
at java.net.URI.toURL(URI.java:1080)
at org.springframework.http.client.SimpleClientHttpRequestFactory.createRequest(SimpleClientHttpRequestFactory.java:109)
我在这里错过了什么?
【问题讨论】:
标签: java spring spring-integration