Код: Выделить всё
@Override
public StreamingResponseBody download() {
Flux dataBufferFlux = webClient.get()
.uri("/download")
.retrieve()
.bodyToFlux(DataBuffer.class);
StreamingResponseBody streamingResponseBody = outputStream -> {
DataBufferUtils.write(dataBufferFlux, outputStream)
.doOnNext(DataBufferUtils::release)
.blockLast();
};
return streamingResponseBody;
}
Код: Выделить всё
@GetMapping(value = "/download", produces = "application/octet-stream")
public ResponseEntity down() {
var download = service.download();
return ResponseEntity.ok().contentType(MediaType.APPLICATION_OCTET_STREAM).body(download);
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... web-client
Мобильная версия