zoukankan      html  css  js  c++  java
  • Struts2版本更新报错:>>> ActionContextCleanUp <<< is deprecated! Please use the new filters!

    因低版本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>
  • 相关阅读:
    poj1006生理周期(中国剩余定理)
    Sort the Array
    pojBuy Tickets2828线段树或者树状数组(队列中倒序插队)
    poj 2187 Beauty Contest(凸包求解多节点的之间的最大距离)
    将数据转化成字符串时:用字符串的链接 还是 StringBuilder
    poj 2031Building a Space Station(几何判断+Kruskal最小生成树)
    java中同步嵌套引起的死锁事例代码
    poj 1905Expanding Rods
    (单例设计模式中)懒汉式与饿汉式在多线程中的不同
    HDU 1024Max Sum Plus Plus(最大m字段和)
  • 原文地址:https://www.cnblogs.com/guyezhai/p/4929400.html
Copyright © 2011-2022 走看看