首页 > springMVC如何修改应答体的conent type?

springMVC如何修改应答体的conent type?

如题。
现在两个headers的contenttype不一致,出现问题了。怎么修改成json呢??

有牛人吗?

修改下面的“Content-Type:text/html;charset=utf-8” 为json。

网上的答案都试过了,在requestmapping 那里设置consumer和production都没用。

jackson的三个包也有了。

Response Headers
view source
Content-Language:en
Content-Length:1095


Content-Type:text/html;charset=utf-8


Date:Mon, 25 Apr 2016 15:18:24 GMT
Proxy-Connection:keep-alive
Server:Apache-Coyote/1.1





Request Headers
view source

Accept:application/json, text/plain, */*

Accept-Encoding:gzip, deflate, lzma
Accept-Language:zh-CN,zh;q=0.8
Connection:keep-alive
Content-Length:48
Content-Type:application/x-www-form-urlencoded
Cookie:JSESSIONID=4106F6516B47C77F9B2B24E76372571C

===============================================

现在我知道了,则会上面的额responseHeaders是返回页面的类型,因为返回的是错误提示的那个页面,所以是text。

但是程序错在不能映射传过来的对象,这才是问题所在。


@ResponseBody这个你加了吗

【热门文章】
【热门文章】