Browse Source

Polish

Issue: SPR-11129
pull/446/head
Rossen Stoyanchev 12 years ago
parent
commit
17e492e641
  1. 2
      spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java
  2. 9
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpHeadersReturnValueHandler.java
  3. 3
      src/asciidoc/index.adoc

2
spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java

@ -195,6 +195,8 @@ import java.util.concurrent.Callable; @@ -195,6 +195,8 @@ import java.util.concurrent.Callable;
* The entity body will be converted to the response stream using
* {@linkplain org.springframework.http.converter.HttpMessageConverter message
* converters}.
* <li>An {@link org.springframework.http.HttpHeaders HttpHeaders} object to
* return a response with no body.</li>
* <li>A {@link Callable} which is used by Spring MVC to obtain the return
* value asynchronously in a separate thread transparently managed by Spring MVC
* on behalf of the application.

9
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpHeadersReturnValueHandler.java

@ -41,17 +41,18 @@ public class HttpHeadersReturnValueHandler implements HandlerMethodReturnValueHa @@ -41,17 +41,18 @@ public class HttpHeadersReturnValueHandler implements HandlerMethodReturnValueHa
@Override
public void handleReturnValue(Object returnValue, MethodParameter returnType,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
mavContainer.setRequestHandled(true);
Assert.isInstanceOf(HttpHeaders.class, returnValue);
HttpHeaders headers = (HttpHeaders) returnValue;
HttpServletResponse response = webRequest.getNativeResponse(HttpServletResponse.class);
ServletServerHttpResponse outputMessage = new ServletServerHttpResponse(response);
if (!headers.isEmpty()) {
HttpServletResponse servletResponse = webRequest.getNativeResponse(HttpServletResponse.class);
ServletServerHttpResponse outputMessage = new ServletServerHttpResponse(servletResponse);
outputMessage.getHeaders().putAll(headers);
outputMessage.getBody(); // flush headers
}
outputMessage.getBody(); // flush headers
}
}

3
src/asciidoc/index.adoc

@ -29033,9 +29033,10 @@ The following are the supported return types: @@ -29033,9 +29033,10 @@ The following are the supported return types:
* If the method is annotated with `@ResponseBody`, the return type is written to the
response HTTP body. The return value will be converted to the declared method argument
type using `HttpMessageConverter` s. See <<mvc-ann-responsebody>>.
* A `HttpEntity<?>` or `ResponseEntity<?>` object to provide access to the Servlet
* An `HttpEntity<?>` or `ResponseEntity<?>` object to provide access to the Servlet
response HTTP headers and contents. The entity body will be converted to the response
stream using `HttpMessageConverter` s. See <<mvc-ann-httpentity>>.
* An `HttpHeaders` object to return a response with no body.
* A `Callable<?>` can be returned when the application wants to produce the return value
asynchronously in a thread managed by Spring MVC.
* A `DeferredResult<?>` can be returned when the application wants to produce the return

Loading…
Cancel
Save