Polish
Issue: SPR-11129
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user