so I am downloading some files using Spring Rest template. I have a requirement to log the progress of the download in backend itself. So can the download progress be logged in some way ?
Here is my implementation :
File file = restTemplate.execute(FILE_URL, HttpMethod.GET, null, clientHttpResponse -> {
File ret = File.createTempFile("download", "tmp");
StreamUtils.copy(clientHttpResponse.getBody(), new FileOutputStream(ret));
return ret;
});
PS: I was thinking if there is a way to intercept how much of the response body is transferred.