HelloWorld 善战者,求之于势,不责于人;故能择人而任势。

知止而后有定,定而后能静,静而后能安,安而后能虑,虑而后能得。物有本末,事有终始。知所先后,则近道矣。

  BlogJava :: 首页 ::  :: 联系 ::  :: 管理 ::
  167 随笔 :: 1 文章 :: 40 评论 :: 0 Trackbacks
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>

posted on 2007-08-13 18:53 helloworld2008 阅读(172) 评论(0)  编辑  收藏 所属分类: java

只有注册用户登录后才能发表评论。


网站导航: