I have a controller method that creates some files on the server and returns their path.:
@RequestMapping(value="/file", method=RequestMethod.GET)
public @ResponseBody String retrieveFile(@RequestParam("userid") String userId){
//Do some work, save a file
File newFile=Utils.getFile(userId);
FileSystemResource f=new FileSystemResource(newFile);
return f.getURL().toString();
}
When running this on my local machine, the response is like this:
file:/D:/SDKs/spring-tool-suite-3.7.1.RELEASE-e4.5.1-win32-x86_64/sts-bundle/sts-3.7.1.RELEASE/file.jpg
when I deployed the app to aws beanstalk, the response was like this:
file:/usr/share/tomcat8/file.jpg
How can I retrieve the absolute file path in a fashion similar to what happens on the local machine?