Granting Keith's wish

This commit is contained in:
Arjen Poutsma 2010-09-03 08:50:45 +00:00
parent 0485f15998
commit b67da6c3f8
2 changed files with 11 additions and 3 deletions

View File

@ -66,7 +66,7 @@ public class HttpEntity<T> {
/** /**
* Create a new, empty {@code HttpEntity}. * Create a new, empty {@code HttpEntity}.
*/ */
private HttpEntity() { protected HttpEntity() {
this(null, null); this(null, null);
} }

View File

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