I created a Java app to store and download big files, so when the client upload a file it will be transfered to the server which will send it to storage cloud service ( azure data lake store ), however when a user try to download a file a request is sent to the server, then the server will send a request to the storage service and the transfert of the file will begin between the server and the storage service, meanwhile the client will be waiting for the transfersbetween these two to end, and this can take a long time ( step 3 in the bellow image ), I'm wondering if there a way to download what is been already collected from azure at the same time?
Here's my code:
@RequestMapping(value = "download", method = RequestMethod.GET, produces = "application/zip")
public ResponseEntity < Resource > download(@PathVariable String path) throws IOException {
InputStream stream = azureDataLakeStoreService.getFile(path);
InputStreamResource resource = new InputStreamResource(stream);
return ResponseEntity.ok()
.header(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, HttpHeaders.CONTENT_DISPOSITION)
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=download.zip")
.contentType(MediaType.parseMediaType("application/octet-stream"))
.body(resource);
}