我想知道我是否遗漏了与http入站网关相关的内容。我想使用可选参数执行搜索(结果将是json)。以下是已定义网关的示例:
<int-http:inbound-gateway id="inboundSearchRequestGateway" supported-methods="GET, POST" request-channel="searchRequest" reply-channel="searchResults"
mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS" view-name="/test123" path="/search" reply-timeout="50000"
error-channel="errorChannel">
<int-http:header name="param1" expression="#requestParams.param1"/>
<int-http:header name="param2" expression="#requestParams.param2"/>
</int-http:inbound-gateway>
目前,我必须为搜索提供两个参数,否则请求不会传递到请求通道。
有问题的搜索目前没有使用参数。
这将返回结果:
http://localhost/test123/search?param1=123¶m2=234
虽然这不会返回任何内容:
http://localhost/test123/search?param1=123
有没有其他方法可以将请求参数映射到集成邮件头中,以便进一步处理链?这甚至可能是一个错误吗?
我正在使用Spring Integration 4.1.2,Windows,Java 7。
感谢。
Ť
答案 0 :(得分:2)
由于requestParams
是Map
,因此请使用#requestParams['param2']
作为可选参数。使用带点的语法需要参数存在。