Prior to this commit, HTTP Range requests were only supported by the
ResourceHttpRequestHandler when serving static resources.
This commit improves the `HttpEntityMethodProcessor` and
the `RequestResponseBodyMethodProcessor`. They now extract
`ResourceRegion`s from the `Resource` instance returned by the
Controller and let the Resource-related message converters
handle the writing of the resource (including partial writes).
Controller methods can now handle Range requests for
return types that extend Resource or HttpEntity:
@RequestMapping("/example/video.mp4")
public Resource handler() { }
@RequestMapping("/example/video.mp4")
public HttpEntity<Resource> handler() { }
Issue: SPR-15789, SPR-13834
@ -790,6 +791,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
@@ -790,6 +791,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
@ -75,6 +80,9 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
@@ -75,6 +80,9 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
@ -183,6 +191,24 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
@@ -183,6 +191,24 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
@ -266,6 +292,13 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
@@ -266,6 +292,13 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
@ -387,14 +387,8 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
@@ -387,14 +387,8 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
@ -71,6 +73,8 @@ public class RequestResponseBodyMethodProcessorMockTests {
@@ -71,6 +73,8 @@ public class RequestResponseBodyMethodProcessorMockTests {
@ -97,11 +101,13 @@ public class RequestResponseBodyMethodProcessorMockTests {
@@ -97,11 +101,13 @@ public class RequestResponseBodyMethodProcessorMockTests {
@ -364,6 +370,37 @@ public class RequestResponseBodyMethodProcessorMockTests {
@@ -364,6 +370,37 @@ public class RequestResponseBodyMethodProcessorMockTests {