I have a very simple HTML form page (which is a part of Spring Boot web application in src/main/resources/public/web.html) to post a String from a textarea to a Spring Boot web application version 1.5.2.
<form action="" method="post"> <textarea cols="128" rows="40" name="query"></textarea> <input value="Send" type="submit"> </form> And the SpringBoot class to handle the POST request:
@RestController public class QueryController { @RequestMapping(value = "/handle", method = RequestMethod.POST) protected void handlePost(@RequestBody String postBody) throws Exception { // Get query from postBody here } } It works with small String from textarea in client. However, when the String is big (e.g: with HTTP request header: Content-Length:3789333 (3 MB)). Spring Boot throws an exception like this:
org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: protected void QueryController.handlePost(java.lang.String) throws java.lang.Exception at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:154) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:128) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121) I'm not sure what causes this problem, I'm running the web application with embedded Tomcat from Spring Boot.