0

获取状态码为 406"The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers."

在升级 spring 版本(3.1.23.2.13)时,我从服务器收到 406 错误。

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({    
            url : /search.htm,
            dataType : json,
            data : postData,
            contentType: application/json,
            .
            .
            .});
  • 春天 3.2.13
  • 杰克逊注释-2.1.2
  • 杰克逊核心2.1.2
  • 杰克逊核心asl-1.9.9
  • 杰克逊-数据绑定-2.1.2
  • 杰克逊-映射器-asl-1.9.9

但是在使用以下配置时,它工作得很好。(这里Content-Type的响应头application/json:)

  • 春天 3.1.2
  • 杰克逊核心asl-1.9.9
  • 杰克逊-映射器-asl-1.9.9

请帮我解决这个问题。

4

0 回答 0