乱炖

一、ResponseBody   、 ResposeEntity

       ResponseBody: return value should be bound to the web response body// 返回值 被绑定到 web的响应体中。

       ResposeEntity:

     (1)Extension of  HttpEntity that adds a  status code.//添加状态代码的HTTP实体的扩展.

     (2) Can also be used in Spring MVC, as the return value from a  method://作为一个方法的返回值,在SpringMVC中

     (3)by using a builder accessible via static methods:

               return  ResponseEntity.created(location).header("MyResponseHeader", "MyValue").body("Hello World"); 

               return  ResponseEntity.status(HttpStatus.CREATED).body("请求体的内容")。

     (4)Create a new {@code HttpEntity} with the given body, headers, and status code.//根据给的体,头 ,状态码 创建一个新的HttpEntity。

猜你喜欢

转载自blog.csdn.net/mobin518/article/details/88033281