any better way than using old servlet api for downloads
Resource interface provides an effective way of accessing the content of the resource and supports handling of all kinds of file resources. Please see if that helps you to some extent.
public ResponseEntity &lt; Resource &gt; downloadFile(String fileName) {

  final String FILE_LOCATION = &quot;/mnt/nfs/myfolder/prod/documents/custom_documents/&quot;;

  File file = new File(FILE_LOCATION + &quot;/&quot; + fileName);

  Path path = Paths.get(file.getAbsolutePath());
  ByteArrayResource resource = new ByteArrayResource(Files.readAllBytes(path));

  HttpHeaders headers = new HttpHeaders();
  //headers.add(HttpHeaders.CONTENT_DISPOSITION, &quot;attachment; filename=&quot; + file.getName());

  return ResponseEntity.ok().headers(headers).contentLength(file.length()).contentType(MediaType.APPLICATION_OCTET_STREAM).body(resource);
}