Is there an alternative way to obtain a reference to a request's body without using the approach with the annotation? I'm using GAE + Spring
and everytime I use @RequestBody
in the signatures of my controller methods, the server returns 415 Unsupported Media Type
. All I'm trying to do is read a JSON encoded message
on a Post method. Thanks.
相关问题
- java.lang.IllegalArgumentException: Cannot set to
- java.lang.NullPointerException at java.io.PrintWri
- Spring Data MongoDB - lazy access to some fields
- Declaring an explict object dependency in Spring
- Decoding body parameters with Spring
相关文章
- java JDK动态代理和cglib动态代理最后获取的代理对象都为null的问题
- org.xml.sax.SAXParseException; lineNumber: 7; colu
- spring-mvc a标签带参怎样向controller发送请求。路径格式?
- SpringMVC如何把File封装到Map中?
- Spring: controller inheritance using @Controller a
- Is there a size limit for HTTP response headers on
- How to load @Configuration classes from separate J
- Java spring framework - how to set content type?
You can take in a parameter of
HttpServletRequest
, and read theServletInputStream
usinggetInputStream()
from there. The stream will contain the body of the request.Try this, on the RequestMapping configure the headers to accept application/json and be sure to configure a jackson message convertor for this type