Support for byte-range requests in Servlet Functional endpoints #24562
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Right now in Spring MVC and WebFlux we support byte-range requests for
Resource
response bodies. This is supported by infrastructure likeResourceRegion
,HttpRange
andResourceRegionHttpMessageConverter
- those are able to convert parts ofResource
instances according to the requested ranges.In Spring MVC, a critical part for that is implemented in
AbstractMessageConverterMethodProcessor
: detecting whether the request asks for byte ranges, and turning theResource
into a collection ofResourceRegion
accordingly, to then let the message converter write those to the response.In Spring MVC functional endpoints, we're missing that last part currently.
We can achieve that currently with:
Now I'm wondering how we could make this easier with functional endpoints. Handling that directly in
ServerResponse
can be challenging since it might be not expected by developers and we don't have access to the request at that point.The
ResourceHandlerFunction
might be a better place for that, but it might lack flexibility since it would only work when mapping a particular handler and not whenever we want to return aResource
as a response body.The text was updated successfully, but these errors were encountered: