mime-mapping的作用及配置

mime-mapping是web.xml中的一个节点,用来指定对应的格式的浏览器处理方式,常用的集中配置如下:

    <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>

    <mime-mapping>
        <extension>doc</extension>
        <mime-type>application/msword</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>xls</extension>
        <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>ppt</extension>
        <mime-type>application/vnd.ms-powerpoint</mime-type>
    </mime-mapping>

另外也可以用来配置静态页面的打开编码:

<!--  修改下面两行以支持静态超文本的自动编码 
  --> 
 <mime-mapping>
  <extension>htm</extension> 
  <mime-type>text/html;charset=gb2312</mime-type> 
  </mime-mapping>
 <mime-mapping>
  <extension>html</extension> 
  <mime-type>text/html;charset=gb2312</mime-type> 
  </mime-mapping>

参考文档:

http://yeminping.iteye.com/blog/482795


你可能感兴趣的:(mime-mapping的作用及配置)