在定义任意HTTP响应标头时,ResponseEntity将为您提供更多的灵活性。在这里查看第4个构造函数:
http://docs.spring.io/spring/docs/3.0.x/api/org/springframework/http/ResponseEntity.html
ResponseEntity(T body, MultiValueMap<String,String> headers, HttpStatus statusCode)
此处列出了可能的HTTP响应标头:
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Responses
一些常用的是状态,内容类型和缓存控制。
如果不需要,使用@ResponseBody会更简洁一些。



