RestTemplate should support streaming download and upload [SPR-16885] #21424
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: declined
A suggestion or change that we don't feel we should currently apply
type: enhancement
A general enhancement
Abhijit Sarkar opened SPR-16885 and commented
ResourceHttpMessageConverter
has aboolean supportsReadStreaming
, which if set, and the response type isInputStreamResource
, returnsInputStreamResource
; otherwise it returns aByteArrayResource
. So clearly, the intent is supporting streaming download.However, there is a problem:
RestTemplate
closes the response soon after theHttpMessageConverter runs
. Thus, even if I asked forInputStreamResource
, and got it, it's no good, because the response stream has been closed. I think it should be dependent on the response type.On the writing side, implementations of
ClientHttpRequestFactory
has aboolean bufferRequestBody
butSimpleClientHttpRequestFactory
(JDK client) andHttpComponentsClientHttpRequestFactory
(Apache HTTP client) support this feature, but notOkHttp3ClientHttpRequestFactory
.Affects: 5.0.2
Reference URL: https://stackoverflow.com/a/48041200/839733
Issue Links:
The text was updated successfully, but these errors were encountered: