lundi 6 avril 2015

Getting Status code as 406 and content-Type of response header is text/html instead of application/json

Getting Status code as 406 "The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers."


While upgrading spring version(3.1.2 to 3.2.13) I am getting 406 error from server.



Content-Type of Response headers:"Content-Type:text/html;charset=utf-8".
Request Header is Accept: application/json, text/javascript, */*; q=0.01.
JavaCode:"@RequestMapping(value = "/search",method = RequestMethod.POST,consumes = "application/json", produces = "application/json")".


Ajax call:



$.ajax({
url : /search.htm,
dataType : json,
data : postData,
contentType: application/json,
.
.
.});



  • Spring 3.2.13

  • jackson-annotations-2.1.2

  • jackson-core-2.1.2

  • jackson-core-asl-1.9.9

  • jackson-databind-2.1.2

  • jackson-mapper-asl-1.9.9


But while using following configurations, its working perfectly.(Here Content-Type of Response headers:application/json)



  • Spring 3.1.2

  • jackson-core-asl-1.9.9

  • jackson-mapper-asl-1.9.9


Please help me to resolve this issue.


Aucun commentaire:

Enregistrer un commentaire