@RequestMapping(value = "")
public void downloadPDF(HttpServletResponse response) {
String pdffilePath = xxx;
String fileName = xxx;
InputStream inStream = null;
try {
File file =new File(pdffilePath);
inStream = new FileInputStream(file);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
response.reset();
response.setContentType("bin");
try {
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("gb2312"), "ISO8859_1") + "\"");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
byte[] b = new byte[10240];
int len;
try {
while ((len = inStream.read(b)) > 0)
response.getOutputStream().write(b, 0, len);
inStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}