You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/12/15 03:32:45 UTC

[GitHub] [servicecomb-java-chassis] huanghezhen opened a new issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

huanghezhen opened a new issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665


   场景是这样的 需要定义一个  post 接收  application/x-www-form-urlencoded 格式的 入参 这个时候 使用 @RequestParam Map<String, String> param 接收 是不被允许的  但是 可以定义成   @RequestBody Map<String, String> param ,但是 文档上写的是   目前支持application/json,plain/text   不包括 application/x-www-form-urlencoded


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] huanghezhen closed issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

Posted by GitBox <gi...@apache.org>.
huanghezhen closed issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] huanghezhen commented on issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

Posted by GitBox <gi...@apache.org>.
huanghezhen commented on issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665#issuecomment-994367524


   现在是 我用 requestbody  确实接收到了 application/x-www-form-urlencoded


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] huanghezhen commented on issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

Posted by GitBox <gi...@apache.org>.
huanghezhen commented on issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665#issuecomment-994260026


   问题1  为什么 @RequestParam Map<String, String> param  不能定义  swagger 不允许定义成这样
   问题2 @requestbody Map<String, String> param 是否可以用来接收  application/x-www-form-urlencoded 入参


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] huanghezhen commented on issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

Posted by GitBox <gi...@apache.org>.
huanghezhen commented on issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665#issuecomment-996398289


   场景是这样的  我们对接别人的接口的时候,  需要我们提供"一个"他们回调的地址 type类型就是 application/x-www-form-urlencoded  ,这个地址是所有的业务的回调地址,所以会根据不同的业务带有不同的参数,并且这些参数 是需要验证签名的,所以 这个接口我们不好定义成对象 所以需要用  map 来接收     所以自然是想到了 这样定义  @RequestParam Map<String, String> param  但是 这样定义  项目是不能启动的 swagger 校验不通过,   我们就使用了 requestbody  结果发现这个可以   但是原生spring mvc 对于 requestbody 的定义 是用来解析 json的   所以 就想跟您确认一下   servicecomb 是否可以使用 requestbody 来接收 form 形式的参数


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] huanghezhen commented on issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

Posted by GitBox <gi...@apache.org>.
huanghezhen commented on issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665#issuecomment-996379804


   因为我看见了 mvc注解 你们是对其重新定义 并且重新实现解析的,  我的新理解是  @RequestParam 是用来接收 url中的参数  @Requestbody 是用来接收body中的参数 (然后根据 json 还是 form  来使用不同的解析方式)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665#issuecomment-994357954


   文档的描述是当前的情况:
   1. 使用body参数,只支持json, text两种格式的映射, 并且text只支持String的映射。 不支持from。 
   2. form只支持 `@FromParam`, 不支持将整个内容映射到 Map。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665#issuecomment-994565724


   查询了测试用例,确实没你说的情况。 有可能某个时候实现了这个功能,项目需要补充测试用例,或者分析下是否要支持这种场景。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2665: 对于 @RequestBody 的 疑问 ,可能需要更新文档

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2665:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2665#issuecomment-997674923


   这种场景当前版本应该是不支持的,我们需要分析下,然后考虑是否在下个版本提供。 
   
   servicecomb的设计约束是“站在使用者的角度,设计接口需要给出具体的语义和参数列表”。 你的场景显然违背了这个约束,但是单纯的针对form,似乎问题也不大。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org