Download file
1) Step:
Ⅰ set contentType response header: Set the type of response is what? Tells the browser to download a file
response.setContentType("appliation/x-msdownload");
Ⅱ disposed response header Content-Disposition: no longer tell the browser from a file browser line processing (or open) to be downloaded, is completed manually by the user
response.setHeader("Content-Disposition","attachment;filename=abc.txt");
Ⅲ specific file: You can call response.getOutputStream way as to IO stream sent to the client
OutputStream out = response.getOutputStream();
String pptFileName = "C:\\Users\\....";
InputStream in = new FileInputStream(pptFileName);
byte[] buffer = new byte[1024];
int len = 0;
while((len = in.read(buffer))!=-1){
out.write(buffer,0,len);
}
in.close();