Currently, I'm using this code in order to download a file:
ResponseEntity<Resource> response = this.restTemplate
.getForEntity(
uriToCall,
Resource.class
);
The problem is that code raises an OutOfMemoryError
when I'm trying to download large files.
Is there any other way to get my large file avoiding this error?
EDIT: Another question.
I was thinking about applying FileSystemResource
instead of Resource
:
ResponseEntity<FileSystemResource> resp = this.restTemplate
.getForEntity(
uriToCall,
FileSystemResource.class
);
Which is the difference between FileSystemResource
and Resource
? That class is going to accomplish my goal?