码迷,mamicode.com
首页 > 其他好文 > 详细

Struts2版本更新报错:>>> ActionContextCleanUp <<< is deprecated! Please use the new filters!

时间:2015-11-02 11:53:45      阅读:269      评论:0      收藏:0      [点我收藏+]

标签:

因低版本Struts2存在漏洞,更新为较新的版本。启动时,报如下警告信息:

***************************************************************************
*                                 WARNING!!!                              *
*                                                                         *
* >>> ActionContextCleanUp <<< is deprecated! Please use the new filters! *
*                                                                         *
*             This can be a source of unpredictable problems!             *
*                                                                         *
*                Please refer to the docs for more details!               *
*              http://struts.apache.org/2.x/docs/webxml.html              *
*                                                                         *
***************************************************************************

自2.1.3版本开始,ActionContextCleanUpFilterDispatcher都由StrutsPrepareAndExecuteFilter代替,配置如下:

注释掉

    <filter>
        <filter-name>struts2CleanupFilter</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2CleanupFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>*.nt</url-pattern>
    <dispatcher>REQUEST</dispatcher> 
    <dispatcher>FORWARD</dispatcher> 
    <dispatcher>INCLUDE</dispatcher>  
</filter-mapping>

改为:

    <filter>
        <filter-name>struts2Filter</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2Filter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

 

另外,如果要使用sitemesh,要按照strutsPrepareFilter -> sitemesh -> strutsExecuteFilter的顺序配置过滤器,将sitemesh配置在中间,如下:

 

<filter>
    <filter-name>strutsPrepareFilter</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
</filter>
<filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter>
    <filter-name>strutsExecuteFilter</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>strutsPrepareFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>strutsExecuteFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

 

Struts2版本更新报错:>>> ActionContextCleanUp <<< is deprecated! Please use the new filters!

标签:

原文地址:http://www.cnblogs.com/guyezhai/p/4929400.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!