I have a BufferedImage in my jersey post call and would like to save it on the server. I can save it to the file system but I want to save it to the server img folder.
EG localhost:8080/server/img
How do I achieve this?
I have a BufferedImage in my jersey post call and would like to save it on the server. I can save it to the file system but I want to save it to the server img folder.
EG localhost:8080/server/img
How do I achieve this?
Use the getRealPath() method of the ServletContext ServletContext.getRealPath to find out the actual directory in your filesystem and save it there. In your case it can be like
String realPathOfImgFolder=req.getServletContext().getRealPath("/img");
Then save the file to this location and it will be available by http://localhost:8080/server/img/<image file name with extension>