tomcate下载时出现乱码配置
tomcat下在浏览器里输入http://localhost:8080/1.rar不是弹出对话框而是在ie里直接乱码形式打开了,请问怎么设置啊?
---------------------------
%TOMCAT_HOME%/conf/web.xml
里面增加rar文件的mime映射就可以了。
具体的添加格式你可以对照doc之类的后缀(默认的web.xml里有这种文件的MIME映射),rar的MIME你在网上搜索一下就有了。
---------------------------
添加rar,iso等的mime-type映射
避免在浏览器里直接打开。
<mime-mapping>
<extension>mht</extension>
<mime-type>text/x-mht</mime-type>
</mime-mapping>
<mime-mapping>
<extension>rar</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>
<mime-mapping>
<extension>iso</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ape</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>
<mime-mapping>
<extension>rmvb</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ico</extension>
<mime-type>image/x-icon</mime-type>
</mime-mapping>
添加在web.xml最后