https://www.jianshu.com/p/d3a46cf4342c
500服务器异常
404找不到页面
400参数类型匹配异常,用户请求SpringMVC参数不匹配,如date用了int接收
304用户第一次请求获取状态码,第二次已缓存
406无法使用请求的内容特性来响应请求的网页
错误的写法
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
@RequestMapping(value="/testJSONP",produces="text/html;charset=utf-8")
@ResponseBody
public MappingJacksonValue testJSONP(String callback) throws JsonProcessingException
{
User user=new User();
user.setId(102);
user.setName("小红");
MappingJacksonValue value=new MappingJacksonValue(user);
value.setJsonpFunction(callback);
return value;
}
正确写法
@RequestMapping("/testJSONP")
@ResponseBody
public MappingJacksonValue testJSONP(String callback) throws JsonProcessingException
{
User user=new User();
user.setId(102);
user.setName("小红");
MappingJacksonValue value=new MappingJacksonValue(user);
value.setJsonpFunction(callback);
return value;
}