Summary of HTTP status codes + understanding

Source: Internet
Author: User

Here is the introduction of Baidu Encyclopedia, but also quite full.

The following is the development process encountered a variety of codes, their own problems of their own reasons, the same code different wrong, cheap smile.

HTTP 406 Not acceptable

The reason for this error is that the framework uses the ' responsebody ' annotations in ' SPRINGMVC ', related JSON Baoquanyo, including:

' org.codehaus.jackson:jackson-mapper-asl:1.9.13 ',' org.codehaus.jackson:jackson-core-asl:1.9.13 ',
' com.fasterxml.jackson.core:jackson-core:2.8.4 ',
' com.fasterxml.jackson.core:jackson-databind:2.8.4 ',
' com.fasterxml.jackson.core:jackson-annotations:2.8.4 '

This is a number of people in the JSON world, my project all have, but still error, 406. The most official definitions of the following 406 have been consulted, and the original text is as follows:

406 not acceptablethe resource identified by the request was only capable of generating response entities which has co Ntent characteristics not acceptable according to the accept headers sent in the request.
Reference translation: The resource identified by the request (resource), capable of generating only response entities with content attributes that are unacceptable based on the accepted headers sent in the request. (In the sauce, live to see it)

That is, I added this thing to the code:

produces = {"Application/json;charset=utf-8"}

It means that the returned data can be formatted in JSON format, or it will explode 406 error. I changed the form of the return data of the code, restart the service, the result is feasible, the error "perfect" release.

Summary of HTTP status codes + understanding

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: 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.