Vikings

对web.xml 的几点配置心得。包括mime-mapping

1.指定了自己的javaEncoding
(参考 http://gceclub.sun.com.cn/staticcontent/html/sunone/app7/app7-dg-webapp/ch6/ch6-4.html 
   <servlet>
        
<servlet-name>jsp</servlet-name>
        
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        
<init-param>
            
<param-name>fork</param-name>
            
<param-value>false</param-value>
        
</init-param>
                
<init-param>
            
<param-name>javaEncoding</param-name>
            
<param-value>GB18030</param-value>
        
</init-param>
        
<init-param>
            
<param-name>xpoweredBy</param-name>
            
<param-value>true</param-value>
        
</init-param>
        
<load-on-startup>3</load-on-startup>
    
</servlet>


 2.添加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>

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


3.对html静态页面设置编码

<!--  修改下面两行以支持静态超文本的自动编码 
  
--> 
 
<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>
  
</web-app>



http://sirsunny.cnblogs.com/archive/2005/08/11/212541.html

posted on 2006-02-17 19:22 Vikings 阅读(4295) 评论(1)  编辑  收藏

Feedback

# re: 对web.xml 的几点配置心得。包括mime-mapping 2009-07-17 19:26 heyuhui

windon  回复  更多评论   



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


网站导航: