'Delete a file after download RestAPI
How can I delete the file after calling this method, I am calling this method from a web service using Spring GET Http. I want to delete the file once it is sent to the client.
public File download(String filePath) {
try {
File file = new File(filePath);
return file;
//this line will never run !!!
Files.delete(filePath);
} catch (Exception e) {
return null;
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
