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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
Then save the file to this location and it will be available by
http://localhost:8080/server/img/<image file name with extension>