How to get the verbatim request body in Spring MVC?

I have a Spring MVC (3.2.2) application where I need to check a cryptographic signature (delivered in a request header) of the request body, which contains data of type application/x-www-form-urlencoded

My problem: Spring MVC seems to make it impossible to get the actual, unprocessed HTTP request body, and thus to check the signature.

  • When I use the @RequestBody annotation in the request handler method, I get the contents, but the individual form fields are in random order - apparently regenerated from parsed form data.
  • When I use a Parameter of type HttpServletRequest , its body is empty
  • so are Reader or InputStream parameters.
  • How can I prevent or bypass this preprocessing of the request body?


    现在,我使用一个servlet过滤器作为解决方法 - 它首先在过滤器链中,读取正文内容并将它们放入请求属性中,然后在控制器中检索该属性。

    链接地址: http://www.djcxy.com/p/48462.html

    上一篇: Spring Portlet MVC中的@RequestBody的替代方案

    下一篇: 如何获得Spring MVC中的逐字请求体?