tomcat配置资源下载
2010/11/17 22:49:45 595755330 http://momo330.javaeye.com
我要评论(0)
- 摘要:很多时候我们从网上下载资源时,不管什么类型的都可以下载到本地。但是我们自己把资源放在服务器上直接在浏览器访问会以文本格式打开,会有很多乱码。其实在tomcat中进行一些配置就可以把资源下载到本地。详细配置在web.xml中添加<mime-mapping><extension>doc</extension><mime-type>application/msword</mime-type></mime-mapping><
- 标签:tomcat配置
很多时候我们从网上下载资源时,不管什么类型的都可以下载到本地。但是我们自己把资源放在服务器上直接在浏览器访问会以文本格式打开,会有很多乱码。
其实在tomcat中进行一些配置就可以把资源下载到本地。详细配置在web.xml中添加
<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>