??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美亚洲免费在线,欧美激情一区二区三区蜜桃视频 ,欧美绝品在线观看成人午夜影视http://www.aygfsteel.com/cuore/category/32846.htmlzh-cnSun, 30 Nov 2008 21:29:20 GMTSun, 30 Nov 2008 21:29:20 GMT60文g下蝲http://www.aygfsteel.com/cuore/archive/2008/11/27/243092.htmlgreedygreedyThu, 27 Nov 2008 13:39:00 GMThttp://www.aygfsteel.com/cuore/archive/2008/11/27/243092.htmlhttp://www.aygfsteel.com/cuore/comments/243092.htmlhttp://www.aygfsteel.com/cuore/archive/2008/11/27/243092.html#Feedback0http://www.aygfsteel.com/cuore/comments/commentRss/243092.htmlhttp://www.aygfsteel.com/cuore/services/trackbacks/243092.html  File fileLoad = new File(path, grade+".zip");//文g名后~
       // the dialogbox of download file.
      //讄响应头和下蝲保存的文件名 
       response.setHeader("Content-disposition", "attachment;filename="downloadname".zip");
       // set the MIME type.
       response.setContentType("application/x-zip");
       // get the file length.
       long fileLength = fileLoad.length();
       String length = String.valueOf(fileLength);
       response.setHeader("Content_Length", length);
       // download the file.
        // 打开指定文g的流信息
       FileInputStream in = new FileInputStream(fileLoad);
       int n = 0;
    //写出信?nbsp;
       while ((n = in.read(b)) != -1) {
           o.write(b, 0, n);
       }
       o.close();
       in.close();




以下转蝲
使用servlet来下载文Ӟ其原理非常简单,只要得到文g的输入流Q或相应字节Q,然后写输出流卛_。现其中的几个l节问题展开Q?
1.      MIMEcd的设|:
Web 览器?MIME cd来识别非 HTML 文Qƈ军_如何昄该文档内的数据?
例如EXCEL文g?MIME cd?"application/vnd.ms-excel "。要用servlet 来打开一?EXCEL 文Q需要将 response 对象?header ?contentType 讄?#8220;application/vnd.ms-excel ”?
response.setContentType(contentType);

2.      Content disposition
HTTP response header中的content-disposition 允许 servlet 指定文档表示的信息。用这Uheader Q你可以将文指定成单独打开Q而不是在览器中打开Q,q可以根据用L操作来显C?
如果用户要保存文档,你还可以文一个文件名。这个徏议名UC出现?Save As 对话框的“文g?#8221;栏中。如果没有指定,则对话框中就会出?servlet 的名字?
servlet 中,?header 讄成下面这P
response.setHeader("Content-disposition","attachment;filename="+ "Example.xls" );

response.setHeader("Content-Disposition",  "inline; filename="fliename)
点击打开会在ie中打开?


需要说明的有三点:
Ø         中文文g名需要进行iso8859-1转码方可正确昄Q?
fileName = new String(fileName.getBytes("GBK"),"iso8859-1");
Ø         传递的文g名,需要包含后~名(如果此文件有后缀名)Q否则丢失文件的属性,而不能自行选择相关E序打开?
Ø         有下载前询问Q是打开文gq是保存到计机Q和通过IE览器直接选择相关应用E序插g打开两种方式Q前者如上代码所C,后者如下:
response.setHeader("Content-disposition","filename="+ "Example.xls" );
3.       在研I文件的上传及下载过E中Q有几点体会
E序的I/O操作往往是性能的瓶颈所在,java io定义了两个基本的抽象c?InputStream和OutputStream,对于不同的数据类型比如磁盘,|络又提供了不同的实玎ͼjava.io也提供了一些缓冲流(BufferedStream)Qɼ盘可以很快的读写一大块的数? 而Java基本的I/OcMơ只能读写一个字?但缓冲流(BufferedStream)可以一ơ读写一Ҏ据,,~冲?Buffered Stream)大大提高了I/O的性能。所?
Ø块块的读写数据会非常?因此,量大块的读写数?nbsp;
Ø使用BufferedInputStream和BufferedOutputStream来批处理数据以提高性能 
Ø对象的序列化(serialization)非常影响I/O的性能,量用  


greedy 2008-11-27 21:39 发表评论
]]>
meta http-equiv 用法?/title><link>http://www.aygfsteel.com/cuore/archive/2008/07/08/213233.html</link><dc:creator>greedy</dc:creator><author>greedy</author><pubDate>Tue, 08 Jul 2008 02:16:00 GMT</pubDate><guid>http://www.aygfsteel.com/cuore/archive/2008/07/08/213233.html</guid><wfw:comment>http://www.aygfsteel.com/cuore/comments/213233.html</wfw:comment><comments>http://www.aygfsteel.com/cuore/archive/2008/07/08/213233.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/cuore/comments/commentRss/213233.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/cuore/services/trackbacks/213233.html</trackback:ping><description><![CDATA[<div><font style="background-color: #f2f9fb"><meta http-equiv> 用法?/font><br /> 1.定义语言  <br />  <br />   格式Q?nbsp; <br />   〈meta  httpQequiv=″ContentQType″  content=″text/html;  charset=gb2312″?nbsp; <br />   q是META最常见的用?在制作网|,在纯HTML代码下都会看到它,它v的作用是定义你网늚语言,当访客浏览你的网|,览器会自动识别q设|网?/div> <div>中的语言,如果你网设|的是GB?而访客没有安装GB?q时|页只会呈现访客人所讄的浏览器默认语言。同L,如果该网|p,那么charset=en?nbsp; <br />  <br />   2.描述|页  <br />   格式:   <br />   〈meta  name=″Keywords″  CONTENT=″china,enterprise,business,net″?nbsp; <br />   META也常用来描述|页,以供某些搜烦站台机器人的使用。大家知?搜烦站台分ؓ两大c?一cMؓ完全人工d,比如YahooQ另一cMؓ机器人搜?以机器h</div> <div>搜烦的搜索站C包含更多的内宏V机器h会搜索网META标签中所讄的描q关键字,把它们加入到搜烦数据库中,用来索引你的|页。而这个标{־有人注</div> <div>意到。在格式?Content列出了你所讄的关键字,q其中的内容可以自行讄,光用逗号盔R。这里有个技?你可以重复某一个单?q样可以提高自己|站?/div> <div>排行位置,如: <br />   〈meta  name=″Keywords″  CONTENT=″china,china,china,china?nbsp; <br />  <br />   3.自动h面  <br />  <br />   格式:  <br />  <br />   〈meta  HTTPQEQUIV=″refresh″  CONTENT=″8;  URL=http://c98.yeah.net″?nbsp; <br />  <br />   大家在浏览某一个网|,会发现有些页在数U后自动转到另外一?q就是META的刷C?在CONTENT?8代表讄的秒?而URL是q?U后自动q接</div> <div>的网地址?nbsp; <br />  <br />   4.|页定评h  <br />  <br />   格式:  <br />  <br />   〈META  httpQequiv=″PICSQLabel″    <br />  <br />   content=′(PICSQ?.1  ″http://www.rsac.org/ratingsv01.html″    <br />  <br />     l  gen  true  comment  ″RSACi  North  America  Server″  <br />  <br />     for  ″http://www.rsac.org″  <br />  <br />     on  ″1996.04.16T08:15Q?500″  <br />  <br />     r  (n  0  s  0  v  0  l  0))′?nbsp; <br />  <br />   在Internet  Explorer  4.0览器Internet选项中有一个内容设|?它可以防止浏览一些受限制的网?而之所以浏览器会自动识别某些网站是否受限制,是</div> <div>因ؓ在网站META标签中已l设|好了该|站的?而该U别的评定是q国RSAC,卛_乐委员会的评U机构评定的,如果你需要评仯q|站,可以q接到网?/div> <div><a >http://www.rsac.org/</a>,按要求提交表?那么RSAC会提供一DMETA代码l你,复制到自q里可以了?nbsp; <br />  <br />   5.控制面~冲  <br />  <br />   格式:  <br />  <br />   〈meta  HTTPQEQUIV=″expires″  CONTENT=″TUE,11.NOV  1998  00:00  GMT″?nbsp; <br />   META可以讄|页到期的时?也就是说,当你在Internet  Explorer  4.0览器中讄览|页旉先查看本地缓冲里的页?那么当浏览某一|页,而本?/div> <div>~冲又有?那么览器会自动览~冲区里的页?直到META中设|的旉到期,q时?览器才会去取得新页面?nbsp; <br />  <br />   6.META的属?nbsp;  <br />   HTTPQEQUIV=″....″  HTTP响应的标题头Q?nbsp;  <br />   name=″.....″  META信息的名Uͼ   <br />   content=″....″  META信息的具体内容;  <br />   scheme=″...″  META信息的图解?br /> ---------------------------------------------------------------------------------------<br /> <META content="C#视频教材,xyBBSpȝ" name="description"><br /> <Meta name="Author" Content="清风Q?a href="mailto:fastait@gmail.com">fastait@gmail.com</a>"><br /> <Meta name="Copyright" Content="本站版权归小雨第二课堂所有。All Rights Reserved"><br /> ---------------------------------------------------------------------------------------<br /> 1?lt;meta http-equiv= "Content-Type"contect="text/html";charset=gb_2312-80">?<meta http-equiv="Content-Language" </div> <div>contect="zh-CN">用以说明主页制作所使用的文字以及语aQ又如英文是ISO-8859-1字符集,q有BIG5、utf-8、shift-Jis、Euc、Koi8-2{字W集Q?/div> <div>2?lt;meta http-equiv="Refresh" content="n; url=  <a href="http://yourlink/">http://yourlink</a>";;> <br />   定时让网在指定的时间nU内Q蟩转到面<a href="http://yourlink/">http://yourlink</a>Q?nbsp; </div> <div>3?lt;meta http-equiv="Expires" contect="Mon,12 May 2001 00:20:00 GMT">可以用于讑֮|页的到期时_一旦过期则必须到服务器上重新调用。需</div> <div>要注意的是必M用GMT旉格式Q?</div> <div>4?lt;meta http-equiv="Pragma" contect="no-cache">是用于设定禁止浏览器从本地机的缓存中调阅面内容Q设定后一旦离开|页无法从Cache中再?/div> <div>出;<br />  <br /> 5?lt;meta http-equiv="set-cookie" contect="Mon,12 May 2004 00:20:00 GMT">cookie讑֮Q如果网过期,存盘的cookie被删除。需要注意的?/div> <div>是必M用GMT旉格式Q?</div> <div>6?lt;meta http-equiv="Pics-label" contect="">|页{评定Q在IE的internet选项中有一内容设|,可以防止览一些受限制的网站,而网站的限制U别</div> <div>是通过meta属性来讄的;</div> <div>7?lt;meta http-equiv="windows-Target" contect="_top">强制面在当前窗口中以独立页面显C,可以防止自己的网被别h当作一个frame调用;</div> <img src ="http://www.aygfsteel.com/cuore/aggbug/213233.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/cuore/" target="_blank">greedy</a> 2008-07-08 10:16 <a href="http://www.aygfsteel.com/cuore/archive/2008/07/08/213233.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">ȫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ƿ</a>| <a href="http://" target="_blank">뽭</a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">Ԫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϸ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̷</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">½</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">пѷ</a>| <a href="http://" target="_blank">״</a>| <a href="http://" target="_blank">ɳƺ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">»</a>| <a href="http://" target="_blank">ӱ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">²</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ξ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ұ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">֦</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ĭ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>