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