|
|
|
|
@ -28,8 +28,7 @@ import org.springframework.util.MultiValueMap;
@@ -28,8 +28,7 @@ import org.springframework.util.MultiValueMap;
|
|
|
|
|
* MediaType contentType = entity.getHeaders().getContentType(); |
|
|
|
|
* HttpStatus statusCode = entity.getStatusCode(); |
|
|
|
|
* </pre> |
|
|
|
|
* Can also be used in Spring MVC, as a return value from a @Controller method: |
|
|
|
|
* <p>Can be used in Spring MVC, as a return value from a @Controller method: |
|
|
|
|
* <p>Can also be used in Spring MVC, as a return value from a @Controller method: |
|
|
|
|
* <pre class="code"> |
|
|
|
|
* @RequestMapping("/handle") |
|
|
|
|
* public ResponseEntity<String> handle() { |
|
|
|
|
@ -47,6 +46,15 @@ public class ResponseEntity<T> extends HttpEntity<T> {
@@ -47,6 +46,15 @@ public class ResponseEntity<T> extends HttpEntity<T> {
|
|
|
|
|
|
|
|
|
|
private final HttpStatus statusCode; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Create a new {@code ResponseEntity} with the given status code, and no body nor headers. |
|
|
|
|
* @param statusCode the status code |
|
|
|
|
*/ |
|
|
|
|
public ResponseEntity(HttpStatus statusCode) { |
|
|
|
|
super(); |
|
|
|
|
this.statusCode = statusCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Create a new {@code ResponseEntity} with the given body and status code, and no headers. |
|
|
|
|
* @param body the entity body |
|
|
|
|
|