I have followed this example:
@RequestMapping(value = "/files/{file_name}", method = RequestMethod.GET)
@ResponseBody
public FileSystemResource getFile(@PathVariable("file_name") String fileName) {
return new FileSystemResource(myService.getFileFor(fileName));
}
from this thread: Downloading a file from spring controllers
This works fine, but instead of downloading the file, the browser displays it.
In the comments someone mentions to add:
produces = MediaType.APPLICATION_OCTET_STREAM_VALUE
in order to force the browser to download the file. However this still doesn't work for me. Anyone have any idea how to force the download?