首页 > 其他 > 详细

在struts2.5版本中使用DMI遇到问题

时间:2017-07-11 18:50:01      阅读:366      评论:0      收藏:0      [点我收藏+]

struts2.5 为了提升安全性,添加了 allomethod 这么个玩意。

解决方法是在配置文件中添加:

   <package name="exam" extends="json-default">

        <global-allowed-methods>regex:.*</global-allowed-methods>

    <action name="user" class="userAction">
            ...
    </action>

    </package>

或者,针对action,在 action 块中添加

<allowed-methods>regex:.*</allowed-methods>

同样也支持在你的 action 上使用 @AllowedMethods 注解
默认的设置为

<global-allowed-methods>execute,input,back,cancel,browse,save,delete,list,index</global-allowed-methods>

全局设置是增量而不是覆盖的,支持正则和直接匹配方法

默认允许的allowedMethods范围

allowedMethods=[
LiteralAllowedMethod{allowedMethod=‘index‘},
LiteralAllowedMethod{allowedMethod=‘input‘},
LiteralAllowedMethod{allowedMethod=‘execute‘},
LiteralAllowedMethod{allowedMethod=‘save‘},
LiteralAllowedMethod{allowedMethod=‘browse‘},
LiteralAllowedMethod{allowedMethod=‘delete‘},
LiteralAllowedMethod{allowedMethod=‘back‘},
LiteralAllowedMethod{allowedMethod=‘list‘},
LiteralAllowedMethod{allowedMethod=‘cancel‘}]

技术分享

 

在struts2.5版本中使用DMI遇到问题

原文:http://www.cnblogs.com/liaojie970/p/7151664.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!