406无法接受:春季3.2 + JSON + AJAX [英] 406 Not Acceptable: Spring 3.2 + JSON + AJAX
问题描述
搜索吨的网站,甚至计算器,但还没有找到一个解决这个问题。貌似很多人都遇到过这个问题,但它似乎是一个统一的解决方案缺少,它包括所有的方面。已经斥资15天了。
Searched tons of sites and even stackoverflow but have not found a solution to this problem. Looks like lot of people have encountered this problem but its seems a unified solution is missing that encompasses all the aspect. Have already spent 1.5 days on it.
我看到该方法得到调用,而是介于 @ResponseBody
未得到正确转换。有人可以来看看,让我知道是什么问题。我已上载在GitHub上code。 链接到源$ C $ C在github
I see the method is getting invoked but somewhere @ResponseBody
is not getting translated properly. Can someone take a look and let me know what the problem is. I have Uploaded the code on github. Link to source code on github
@RequestMapping(value = "/find_user", method = RequestMethod.GET)
public @ResponseBody List<String> findUser(@RequestParam("term") String name) {
log.info("Search string for user name: " + name);
List<String> users = new ArrayList<String>();
users.add("Sam");
users.add("Dan");
return users;
}
下面的浏览器截屏与406响应
Browser screen shot below with 406 response
请注意:啊!如何痛苦。这种设置适用于春3.1.4而不是3.2.X
推荐答案
上帝,它几乎杀死我。我试着尽我所能,还是卡在那里。但最后我想通了。原因是春天,春天下载3.1.1,并与3.1.1jars替换所有的罐子,和它的作品。所有你的配置还是不错的。
God, it almost kills me. I tried whatever I can, still stuck there. But finally I figured it out. The reason is Spring, download Spring 3.1.1 and replace all the jars with 3.1.1jars, and it works. All your config is good.
这篇关于406无法接受:春季3.2 + JSON + AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!