Description
Hadrien Kohl opened SPR-14882 and commented
This issue has been updated to reflect the actual outcome of the discussion. See next section and comments for the original report.
The ResourceHttpMessageConverter
supports converting from an HttpInputMessage
to an InputStreamResource
. This is valid when reading resources on the server side, but it's not compatible with the way RestTemplate
works.
The API exposed by RestOperations
imply that the HTTP server response should be fully consumed and properly closed by the time the exchange
method returns. In other words, this HTTP client does not support streaming the HTTP response.
The current arrangement allows reading InputStreamResource
with RestTemplate
, which should not be possible.
Original report:
InputStreamResource are closed by SimpleClientHttpResponse
The http stream wrapped by InputStreamResource is closed by SimpleClientHttpResponse, rendering it unusable.
I'll make a PR with a test.
Affects: 4.3.3
Reference URL: #18612
Issue Links:
- RestTemplate should support streaming download and upload [SPR-16885] #21424 RestTemplate should support streaming download and upload ("is duplicated by")
- HTTP persistent connections for HTTP Invoker and RestTemplate [SPR-14040] #18612 HTTP persistent connections for HTTP Invoker and RestTemplate
- ResourceHttpMessageConverter should read the Content-Disposition header (if available) to get the file name [SPR-15191] #19757 ResourceHttpMessageConverter should read the Content-Disposition header (if available) to get the file name
Referenced from: commits afd93a0