Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring集成将路径变量和post主体组合在有效负载表达式中_Java_Spring_Spring Integration_Spring El - Fatal编程技术网

Java Spring集成将路径变量和post主体组合在有效负载表达式中

Java Spring集成将路径变量和post主体组合在有效负载表达式中,java,spring,spring-integration,spring-el,Java,Spring,Spring Integration,Spring El,使用http入站网关,我能够使用SPEL指定有效负载表达式,该表达式将访问header、requestParams和pathVariables。我如何也包括来自帖子的正文?我目前拥有的一个例子是 <int-http:inbound-gateway path="/document/{product}/{id}/blah" supported-methods="GET" request-ch

使用http入站网关,我能够使用SPEL指定有效负载表达式,该表达式将访问header、requestParams和pathVariables。我如何也包括来自帖子的正文?我目前拥有的一个例子是

<int-http:inbound-gateway path="/document/{product}/{id}/blah"
                          supported-methods="GET"
                          request-channel="documentService.blah"
                          reply-channel="httpReplyChannel"
                          message-converters="jsonMessageConverter"
                          header-mapper="defaultHttpHeaderMapper"
                          payload-expression="new RequestDTO(
                                                 #pathVariables.product,
                                                 #pathVariables.id,
                                                 #requestParams['optionalParam'],
                                                 headers.get('headerKey')) />
是的,这是可能的。 有效负载表达式评估上下文HttpEntity一起用作根对象#请求参数#路径变量变量。 所以,如果你把它改成POST,你可以得到一具尸体

 payload-expression="new RequestDTO(
                         #pathVariables.product,
                         #pathVariables.id,
                         #requestParams['optionalParam'],
                         headers.get('headerKey'),
                         body)" 

这只是因为HttpEntity有那个getter

阿泰姆,谢谢,这不仅仅是清理身体。我一直不明白负载表达式使用的是什么上下文。我确信这是我在文档中浏览过多次的东西,但它没有点击。谢谢你完整的回答!