Jetty Error: BadMessage:java.lang.IllegalStateException:too much data after closed for Httpchanneloverhttp@472adad9{r=2,c =false,a=idle,uri=}

Source: Internet
Author: User

Recently ran spring MVC with jetty to receive the POST request (the data in the post is very large). There is an issue where data cannot be obtained. Such as:

@RequestMapping (value = "/receive", method = requestmethod.post) Public

Where a is obtained from post, before the amount of data is small, it can be taken without problems.

Using the grab Bag tool, we found that the post data was not finished and the HTTP returned. This is weird.

Adjust the following parameter values:

      <Setname= "Outputbuffersize">< Propertyname= "Jetty.output.buffer.size"default= "32768" /></Set>      <Setname= "Requestheadersize">< Propertyname= "Jetty.request.header.size"default= "8192" /></Set>      <Setname= "Responseheadersize">< Propertyname= "Jetty.response.header.size"default= "8192" /></Set>      <Setname= "Headercachesize">512</Set>

Changed a lot, 10 times times the increase, the results too much data is not reported, but still do not take the parameters. It's very big and there's a memory overflow, and it's going to have to be small. Other parameters, such as the number of threads.

Change the way modify Content-type to application/x-www-form-urlencoded or multipart/form-data, just as no effect.

After trying multiple ways, using @requestbody to annotate a, the result is successful. And you do not need to adjust the jetty parameters.

Why use @requestbody?

@RequestBody

Role:

    1. This annotation is used to read the body portion of the request requests, parse using the system default configuration Httpmessageconverter, and then bind the corresponding data to the object to be returned;
    2. The object data returned by the Httpmessageconverter is then bound to the parameters of the method in the controller.

Use time:

A) GET, post method, according to the request Header Content-type value to determine:

    • application/x-www-form-urlencoded, Optional (that is, not necessary, because the data of this situation @requestparam, @ModelAttribute can also be processed, of course @requestbody can also handle);
    • Multipart/form-data, cannot be processed (i.e. using @requestbody cannot process data in this format);
    • Other formats must be (other formats include Application/json, Application/xml, etc.). Data in these formats must be handled using @requestbody);

B) When put is submitted, it is judged according to the value of the request Header Content-type:

    • Application/x-www-form-urlencoded, must;
    • Multipart/form-data, unable to deal with;
    • Other formats, must;

Description: The data encoding format of the body part of request is specified by the Content-type of the header section;

Reference:

http://blog.csdn.net/arsenal04/article/details/41484685 (the above content transferred from this article, first record first, to be resolved)

Https://stackoverflow.com/questions/29527803/eliminating-or-understanding-jetty-9s-illegalstateexception-too-much-data-aft

Jetty Error: BadMessage:java.lang.IllegalStateException:too much data after closed for [email protected]{r=2,c= false,a=idle,uri=}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.