【发布时间】:2014-04-18 05:30:52
【问题描述】:
我尝试通过出站网关将类型为 MultiValueMap 的有效负载发送到 Spring MVC 控制器。但似乎地图数据没有到达控制器。不知道有什么问题或遗漏。我的代码是这样的:
出站配置:
<int-http:outbound-gateway id="outGateway"
http-method="POST"
request-channel="responseChannel"
url="http://localhost:8081/SpringIntegration-In-out-test/responseReq"
extract-request-payload="true">
</int-http:outbound-gateway>
控制器配置:
@RequestMapping("/responseReq")
public ModelAndView goResponse(@RequestBody MultiValueMap<String,String> body){
Iterator it = body.entrySet().iterator();
while (it.hasNext()) {
MultiValueMap.Entry pairs = (MultiValueMap.Entry)it.next();
System.out.println(pairs.getKey() + " = " + pairs.getValue());
it.remove();
}
return new ModelAndView("response");
}
我使用 Iterator 来获取地图值,但它什么都没有。
【问题讨论】:
标签: java spring spring-mvc spring-integration