jfinal拦截器
来源:互联网 发布:大数据 风险管理 编辑:程序博客网 时间:2024/05/01 05:59
Interceptors是jfinal aop的实现方式,通过实现Interceptor接口以及使用@Before可以精确进行配置,Interceptor接口仅仅定了一个方法void intercept(ActionInvocation ai);我们可以让一个类实现这个接口,重写方法,如:public class DemoInterceptor implements Interceptor {public void intercept(ActionInvocation ai) {System.out.println("Before action invoking");ai.invoke();System.out.println("After action invoking");}}就写好了一个拦截器。拦截器配置有三个级别,global级,controller级,action级。global级的拦截器将对所有的action进行拦截,controller级拦截器将对该controller中的所以action拦截,action级拦截器只对该action进行拦截。global级拦截器在public void configInterceptor(Interceptors me) { me.add(new DemoInterceptor()); }中配置,controller级拦截器使用@Before放在controller类定以前进行配置,action级拦截器使用@Before放在action定义前进行配置。具体配置如下:@Before(DemoInterceptor.class) // 配置一个Controller级别的拦截器public class HelloController extends Controller {@Before(AaaInterceptor.class)public void index() {renderText("配置一个action级别的拦截器");}@Before({AaaInterceptor.class, BbbInterceptor.class})public void test() {renderText("配置多个action级别的拦截器");}@ClearInterceptorpublic void login() {renderText("清除上一级别(Controller级)的拦截器");}@ClearInterceptor(ClearLayer.ALL)public void clearAllLayers() {renderText("清除所有级别(Global级与Controller级)的拦截器");}}
0 0
- jfinal拦截器
- JFinal拦截器Interceptor
- jfinal拦截器配置
- 2014.5.29 JFinal 拦截器
- jfinal中Interceptor拦截器的使用
- [JFinal 1] JFinal和SSH中使用拦截器的对比
- 【JFinal】JFinal的拦截器获取和修改controller返回的json对象
- Jfinal登录拦截器,死循环,原因以及解决办法
- jfinal post请求拦截类
- jfinal框架中控制请求访问方式get or post 的拦截器写法
- jfinal
- JFinal
- jfinal
- jfinal
- JFinal
- jfinal
- JFinal
- JFinal
- 如何让网站被百度快速收录
- onMeasure(int widthMeasureSpec, int heightMeasureSpec)
- 编译appche http server:
- 8、手机防盗--通过拨号进入手机防盗
- MFC中通过Tooltip类来实现悬浮鼠标显示提示信息
- jfinal拦截器
- 简单的WebService编写与调用
- android 屏幕截屏源码分享
- 10 款优秀的在线 JavaScript 工具推荐
- MATLAB内存管理
- MyEclipse6.5 @Override 时出错误 The method of type must override a superclass method
- centos 安装mysql
- 设计模式之策略模式
- matlab编程入门学习(2)