文件下载
//下载
@RequestMapping("down")
public void down(String filename, HttpServletRequest request, HttpServletResponse response) throws IOException {
//设置响应头
response.setHeader("Content-Disposition", "attachment;filename="+filename);
//获取文件路径
String path = request.getServletContext().getRealPath("/file");
File file = new File(path,filename);
//获取输出流(字节流)
ServletOutputStream os = response.getOutputStream();
os.write(FileUtils.readFileToByteArray(file));
os.flush();
os.close();
}