From b67da6c3f8a15db20ae2ecb3171460916f2f69d0 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Fri, 3 Sep 2010 08:50:45 +0000 Subject: [PATCH] Granting Keith's wish --- .../java/org/springframework/http/HttpEntity.java | 2 +- .../org/springframework/http/ResponseEntity.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/org.springframework.web/src/main/java/org/springframework/http/HttpEntity.java b/org.springframework.web/src/main/java/org/springframework/http/HttpEntity.java index edbec742481..20187c10442 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/HttpEntity.java +++ b/org.springframework.web/src/main/java/org/springframework/http/HttpEntity.java @@ -66,7 +66,7 @@ public class HttpEntity { /** * Create a new, empty {@code HttpEntity}. */ - private HttpEntity() { + protected HttpEntity() { this(null, null); } diff --git a/org.springframework.web/src/main/java/org/springframework/http/ResponseEntity.java b/org.springframework.web/src/main/java/org/springframework/http/ResponseEntity.java index 490cf87dca3..45f6e27bb4a 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/ResponseEntity.java +++ b/org.springframework.web/src/main/java/org/springframework/http/ResponseEntity.java @@ -28,8 +28,7 @@ import org.springframework.util.MultiValueMap; * MediaType contentType = entity.getHeaders().getContentType(); * HttpStatus statusCode = entity.getStatusCode(); * - * Can also be used in Spring MVC, as a return value from a @Controller method: - *

Can be used in Spring MVC, as a return value from a @Controller method: + *

Can also be used in Spring MVC, as a return value from a @Controller method: *

  * @RequestMapping("/handle")
  * public ResponseEntity<String> handle() {
@@ -47,6 +46,15 @@ public class ResponseEntity extends HttpEntity {
 
 	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