struts2中关于拦截器Interceptor中的excludeMethods和includeMethods
来源:互联网 发布:大连软件外包 编辑:程序博客网 时间:2024/05/17 02:52
通过对struts2的学习,对于interceptor中的excludeMethods与includeMethods的理解:
针对MethodFilterInterceptor:
excludeMethods表示排除指定的方法,即不对标记为excludeMethods的方法进行拦截,
includeMethods表示包含指定的方法,即对标记为includeMethods的方法进行拦截,
在struts.xml中关于excludeMethods和includeMethods有两种实现方式,一种相当于全局,另一种相当于局部,即<interceptors>
而 <interceptor-refname="method">
为局部,若全局中的param定义为excludeMethods同样局部中的param也定义为excludeMethods,则局部中的param生效,全局中的param无效,即被局部中的param覆盖,同样,若全局中的param定义为includeMethods同样局部中的param也定义为includeMethods,则局部中的param生效,全局中的param无效,即被局部中的param覆盖。
当全局中的param与局部中的param不相同的时,即当全局中param为excludeMethods而局部中的param为includeMethods和全局中的param为includeMethods而局部中param为excludeMethods,则标志为includeMethods生效,即若是全局中的param定义为includeMethods,则全局屏蔽局部,以全局为准,反之,以局部为准。
尤其值得注意的是,自定义的拦截器类一定要继承MethodFilterInterceptor
struts2MethodFilterInterceptor类,该类是AbstractInerceptor的子类,可以实现对Action方法的拦截.实现MethodFilterInterceptor才能使用方法拦截
MethodFilterInterceptor中有两个方法
setExcludeMethods:排除需要过滤的方法
setIncludeMethods:设置需要过滤的方法
如果一个方法同时在excludeMethods和includeMethods中出现,则会被拦截
- struts2中关于拦截器Interceptor中的excludeMethods和includeMethods
- struts2中关于拦截器Interceptor中的excludeMethods和includeMethods的理解
- struts2中方法拦截器(Interceptor)的中的excludeMethods与includeMethods的理解
- struts2中方法拦截器(Interceptor)的中的excludeMethods与includeMethods的理解
- Struts2的Interceptor中使用includeMethods 和 excludeMethods
- Struts2拦截器属性excludeMethods、includeMethods配置无效的原因
- Struts2拦截器属性excludeMethods、includeMethods配置无效之解决方法
- Struts2拦截器属性excludeMethods、includeMethods配置无效之解决方法
- struts拦截器includeMethods或excludeMethods没起作用
- Struts2中的拦截器interceptor
- Struts2的拦截器笔记--excludeMethods
- Struts2中关于Interceptor拦截器的一些原理。
- 浅谈Struts2中的拦截器,Interceptor
- struts2 拦截器Interceptor中取得request
- Struts2中Interceptor拦截器的使用
- Struts2拦截器(Interceptor)
- Struts2拦截器(Interceptor)
- struts2 拦截器 interceptor
- 把一个字符串的大写字母放到字符串的后面 ,各个字符的相对位置不变,不能申请额外的空间
- C++浮点数的比较问题
- 从头来过_要学游戏了么?
- python 的 __future__ 模块
- 亿能测试 发布 《Java常见安全漏洞与代码审查CheckList》 V1.0
- struts2中关于拦截器Interceptor中的excludeMethods和includeMethods
- linux基础知识学习笔记
- DNS域名解析协议详解
- C++运算符的优先级和结合性
- VMware vSphere5.0 HA高可用性原理
- 编译Android中的module
- sturts2学习——常用标签
- HTML中Img标签的技巧
- 【Struts2+Spring3+Hibernate3】SSH框架整合