public void downloadPic(HttpServletRequest request, HttpServletResponse response,String path,String fileName){
try {
request. setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
response. setCharacterEncoding("UTF-8");
URL url = new URL(path);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
InputStream fis = new BufferedInputStream(connection.getInputStream());
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
response.addHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".jpg").getBytes("utf-8"),"ISO-8859-1"));
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
toClient.write(buffer);
toClient.flush();
toClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}