1. You need to give valid path and include response modify the content type to download the image type
2. On the other server where file is located, you need to have permission to access the file
String filename = (String) request.getAttribute("fileName");
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition",
"attachment;filename="+filename);