在@ResponseBody返回类型; 406错误接受头 [英] @ResponseBody in return type ; 406 error for accept header
问题描述
我使用Spring MVC中以
I am using Spring MVC with
<mvc:annotation-driven/>
在我的配置文件。
我的位指示的方法是
public @ResponseBody ArrayList<AccountDetails> create(UploadItem uploadItem) {
..............
return list;
}
使用jre1.7
Using jre1.7
仍然得到HTTP状态406错误接受头..
Still getting HTTP Status 406 error for accept headers..
推荐答案
我们遇到了类似406的回报code从春天时接受头部是正确的,但JAXB配置失踪,其中封送对象所在的包名(罐子里有一个jaxb.index文件,该包中,但春/ JAXB并不知情。
We encountered a similar 406 return code from Spring when the accept header was correct but the JAXB configuration was missing the package name where the marshaled objects reside (the jar had a jaxb.index file in that package but Spring/JAXB was unaware of it.
&LT; OXM:JAXB2-编组ID =jaxbMarshaller
的contextPath =冒号分隔列表-OF-包/>
<oxm:jaxb2-marshaller id="jaxbMarshaller" contextPath="colon-separated-list-of-packages" />
这是使用Spring 3.20
This is with Spring 3.20
这篇关于在@ResponseBody返回类型; 406错误接受头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!