public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String filename="测试";
String client = request.getHeader("user-agent").toLowerCase();
System.out.println(client);
if (client.indexOf("msie") >= 0) {
filename = java.net.URLEncoder.encode(filename, "utf-8");
filename = javax.mail.internet.MimeUtility.encodeText(filename,"utf-8","B");
} else {
filename = javax.mail.internet.MimeUtility.encodeText(filename,"utf-8","B");
}
response.setContentType("APPLICATION/OCTET-STREAM");
response.addHeader("Content-Disposition", "attachment; filename="+filename+".exe");
OutputStream os = response.getOutputStream();
File f = new File ("C:/Downloads/MyEclipse_5.5M2_E3.2.2_Installer.exe");
FileInputStream isf = new FileInputStream(f);
InputStreamReader isr = new InputStreamReader(isf);
BufferedReader rb = new BufferedReader(isr);
byte[] b = new byte[10240];
int i = 0;
while (isf.read(b) != -1) {
// os.write(b);
}
for (int x = 0; x < 100000; x++) {
os.write(("enum"+x+",\r\n").getBytes());
}
os.close();
}
</script>