@RequestMapping(value="file/apk/{name}/", method = RequestMethod.GET)
public void downloadExcel(HttpServletRequest request, @PathVariable("name") String name, HttpServletResponse response) throws IOException{
String path = request.getSession().getServletContext().getRealPath(appManageService.apkPath) + "/" + name;// + "\\" + name;
File file = new File(path);
InputStream inputStream = new FileInputStream(file);
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + name);
response.setContentLength(inputStream.available());
OutputStream os = response.getOutputStream();
byte[] b = new byte[1024];
int length;
while((length=inputStream.read(b))>0){
os.write(b,0,length);
}
inputStream.close();
public void downloadExcel(HttpServletRequest request, @PathVariable("name") String name, HttpServletResponse response) throws IOException{
String path = request.getSession().getServletContext().getRealPath(appManageService.apkPath) + "/" + name;// + "\\" + name;
File file = new File(path);
InputStream inputStream = new FileInputStream(file);
response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + name);
response.setContentLength(inputStream.available());
OutputStream os = response.getOutputStream();
byte[] b = new byte[1024];
int length;
while((length=inputStream.read(b))>0){
os.write(b,0,length);
}
inputStream.close();
}