posts - 24,  comments - 25,  trackbacks - 0
我们有时需要从服务器端下载一个文件,比如POI中我写的Excel文件,它是直接使用浏览器打开的,但是我们要下载到本地,其实在web.xml里配置下就OK了:

 

<mime-mapping> 
<extension>doc</extension>
<mime-type>application/msword</mime-type> 
</mime-mapping> 
<mime-mapping> 
<extension>xls</extension> 
<mime-type>application/msexcel</mime-type> 
</mime-mapping> 
<mime-mapping> 
<extension>pdf</extension> 
<mime-type>application/pdf</mime-type> 
</mime-mapping>
<mime-mapping> 
<extension>zip</extension> 
<mime-type>application/zip</mime-type> 
</mime-mapping>
<mime-mapping> 
<extension>rar</extension> 
<mime-type>application/rar</mime-type> 
</mime-mapping>
<mime-mapping> 
<extension>txt</extension> 
<mime-type>application/txt</mime-type> 
</mime-mapping>
<mime-mapping> 
<extension>chm</extension> 
<mime-type>application/mshelp</mime-type>
</mime-mapping> 
<mime-mapping>
 
<extension>mp3</extension>
 
<mime-type>audio/x-mpeg</mime-type>
</mime-mapping>


 

常见的MIME类型

超文本标记语言文本 .htm,.html text/html
普通文本 .txt text/plain
RTF文本 .rtf application/rtf
GIF图形 .gif image/gif
JPEG图形 .ipeg,.jpg image/jpeg
au声音文件 .au audio/basic
MIDI音乐文件 mid,.midi audio/midi,audio/x-midi
RealAudio音乐文件 .ra, .ram audio/x-pn-realaudio
MPEG文件 .mpg,.mpeg video/mpeg
AVI文件 .avi video/x-msvideo
GZIP文件 .gz application/x-gzip
TAR文件 .tar application/x-tar


posted on 2008-02-15 11:48 Jarry 阅读(819) 评论(0)  编辑  收藏 所属分类: web

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


网站导航: