首页 > 代码库 > HTTP Status 406 --- not acceptable according to the request "accept" headers
HTTP Status 406 --- not acceptable according to the request "accept" headers
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
使用以下方案解决
springmvc json配置方案
Spring4.1.0
使用<annotation-driven />MVC配置方法。
在pom.xml中增加
1 <dependency> 2 <groupId>com.fasterxml.jackson.core</groupId> 3 <artifactId>jackson-core</artifactId> 4 <version>2.4.3</version> 5 </dependency> 6 <dependency> 7 <groupId>com.fasterxml.jackson.core</groupId> 8 <artifactId>jackson-databind</artifactId> 9 <version>2.4.3</version>10 </dependency>11 <dependency>12 <groupId>com.fasterxml.jackson.core</groupId>13 <artifactId>jackson-annotations</artifactId>14 <version>2.4.3</version>15 </dependency>
controller方法中增加@org.springframework.web.bind.annotation.ResponseBody注解
可以解决标题中的问题
HTTP Status 406 --- not acceptable according to the request "accept" headers
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。