HTTP Status 406 – Not Acceptable

前端调用这个方法报错:

HTTP Status 406 – Not Acceptable



Type Status Report

Description The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request, and the server is unwilling to supply a default representation.

方法使用了@ResponseBody来返回json,然后注解 produces="text/html;charset=UTF-8" 又说返回的是 text/html,互相矛盾,去掉注解  produces="text/html;charset=UTF-8"  就好了。

原文地址:https://www.cnblogs.com/digdeep/p/11600649.html

时间: 2024-08-30 08:39:34

HTTP Status 406 – Not Acceptable的相关文章

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

SpringMVC异常报406 (Not Acceptable)的解决办法

使用SpsringMVC,使用restEasy调试,controller请求设置如下: Java代码   @RequestMapping(value="/list",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_VALUE) @ResponseBody public List<EditTimeout> list(){ List<EditTimeout> list = editImpl.s

springmvc @ResponseBody返回json 报406 not acceptable

今天在做springmvc的@ResponseBody返回json的例子时,碰到了这样一个问题"406 (Not Acceptable)",百度之后发现在缺了一个依赖包jackson-databind. 1.spring-mvc.xml配置文件 2.pom.xml文件 [email protected]代码

Spring4 MVC json问题(406 Not Acceptable)

最近使用spring4.0的Mvc,json请求时,客户端报错,406 Not Acceptable 解决方法一: 1.导入第三方的jackson包,jackson-mapper-asl-1.9.7.jar和jackson-core-asl-1.9.7.jar. 2.Spring配置文件添加: [html]  view plain copy <mvc:annotation-driven/> !-- 避免IE执行AJAX时,返回JSON出现下载文件 --> <bean id=&quo

Spring SpringMvc 406 Not Acceptable

406 Not Acceptable 缺少转换依赖的jar包,设置了@ResponseBody,要把对象转换成json格式. 解决方法: pom.xml文件增加 <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>1.8.9</version> </depende

调用odata返回406 not acceptable解决方案

调用odata返回406 not acceptable解决方案 在web api项目中使用odata时,总是返回406 not acceptable 根据http://stackoverflow.com/questions/26676879/webapi-and-odatacontroller-return-406-not-available和http://stackoverflow.com/questions/26676879/webapi-and-odatacontroller-return

Spring MVC 以.html为后缀名访问获取数据,报406 Not Acceptable错误。

如题,最近以spring mvc作为后台框架,前端异步获取数据时(.html为后缀名的访问方式),报406 Not Acceptable错误.当初都不知道啥原因,前后台都没报错就是返回不了数据,于是查了下http 406响应码:406 (SC_NOT_ACCEPTABLE)表示请求资源的MIME类型与客户端中Accept头信息中指定的类型不一致.下面请看出错的操作流程及代码: 1.先配置spring mvc 核心servlet (DispatcherServlet) 至web.xml中,其中配置

nuget包管理nuget服务器发布包时出现请求报错 406 (Not Acceptable)

在window服务器上部署nuget服务器时,发布包时出现请求报错 406 (Not Acceptable) 验证用户名.密码正确的情况下,还是出现上面错误.后面跟踪服务器日志,发现window\temp文件超过65535,删除过期临时文件后即可 原文地址:https://www.cnblogs.com/94cool/p/10749129.html

Spring MVC 的json问题(406 Not Acceptable)

原因 : 就是程序转换JSON失败. 在pom.xml 加上 <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.2</version> </dependency> spring mvc 转化JSON 它所使用的json转换器是http: