Spring integration 使用可选请求参数的Http入站网关

Spring integration 使用可选请求参数的Http入站网关,spring-integration,Spring Integration,我想知道我是否缺少与http入站网关相关的内容。我想使用可选参数执行搜索(结果将是json)。以下是已定义网关的示例: <int-http:inbound-gateway id="inboundSearchRequestGateway" supported-methods="GET, POST" request-channel="searchRequest" reply-channel="searchResults" mapped-response-headers="Return-St

我想知道我是否缺少与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

是否有其他方法将请求参数映射到集成消息头中,以便在链的下游进行进一步处理?这可能是一只虫子吗

我使用的是SpringIntegration4.1.2、Windows和Java7

谢谢


T

因为
requestParams
是一个
映射
,所以使用
#requestParams['param2']
作为可选参数。使用虚线语法要求参数存在。

Perfect。我知道我遗漏了一些简单的东西。再一次来自Spring团队的惊人响应时间。谢谢你,加里。