https://github.com/spring-projects/spring-framework/blob/1984cfe9d79e8a34955a393ef9d71a2a3d11a87c/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java#L196-L213
Debugged through the code.
What I observed was in the lines
body = HttpRange.toResourceRegions(httpRanges, resource);
valueType = body.getClass();
valueType
is always an Arraylist
since the return type of the toResourceRegions
is a List<ResourceRegion>
.
This is causing the later logic related to message converters based on valueType
to fail.
In the end we get the exception as below:
org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class java.util.ArrayList] with preset Content-Type 'application/vnd.ncr.connections.cs.car.v1+zip'
org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:312)
Comment From: rstoyanchev
The ResourceRegionHttpMessageConverter
is able to write a List of regions for any MediaType. It matches to the targetType
which is the RESOURCE_REGION_LIST_TYPE
constant. We also have a test RequestResponseBodyMethodProcessorMockTests#handleReturnTypeResourceByteRange
that performs a range request with a Resource
. It's not FileSystemResource
but that shouldn't matter as long as it's not InputStreamResource
.
Please, debug further or provide something we can run to understand the actual issue.
Comment From: ab185034
I missed the ResourceRegionHttpMessageConverter. Was using the resource converter. This is not an issue. Closing this.