not acceptable according to the request "accept" headers 问题解决
来源:互联网 发布:淘宝中学科学实验室 编辑:程序博客网 时间:2024/05/18 15:04
背景
使用swfupload 上传文件,后台用spring controller进行处理,报not acceptable according to the request "accept" headers错误。
原因
swfupload上传的HTTP头中,发送的指令Accept:text/*,而Spring Controller中返回的为application/json:
@RequestMapping(value = "/upload", method = RequestMethod.POST, produces = "application/json")
public @ResponseBody String login(
@RequestParam MultipartFile[] myfiles,
HttpServletRequest request,
HttpServletResponse response) {
//...
}
返回类型使用produces参数指定,返回的数据内容类型与请求的不一致,故报错。
解决
将produces参数值修改为“text/json”则该错误消除。
0 0
- not acceptable according to the request "accept" headers 问题解决
- SpringMVC 406 not acceptable according to the request "accept" headers.
- SpringMVC返回JSON错误: HTTP Status 406 -- not acceptable according to the request "accept" headers
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- JSTL Exception: According to TLD or attribute directive in tag file, attribute items does not accept
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- according to tld or attribute directive in tag file attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- notepad++使用
- UVA 11762 Race to 1
- ios 拨打电话
- OVMF基础
- 数据结构实验之二叉树一:树的同构
- not acceptable according to the request "accept" headers 问题解决
- hadoop fs 命令
- Mac中显示隐藏文件
- SDTU(3374) 数据结构实验之查找二:平衡二叉树
- HDU 1856More is better
- codeforces 702A 水 最长连续上什子序列
- 欢迎界面2秒跳转
- 机器学习实战——交叉验证
- [leetcode]143. Reorder List -- JavaScript 代码