實現攔截功能的類有
一
二
三
下面看一些代碼片斷:
MainInteceptor:
private List<IInterceptor> interceptors;//定義一系列的子攔截器
public void setInterceptors(List<IInterceptor> interceptors) {
this
}
在before(Method method
WebContext ctx = WebContextFactory
HttpSession session = ctx
AopContext context = new AopContext(); context
for(Iterator it = erator(); it
IInterceptor interceptor = (IInterceptor) it
interceptor
}
IInterceptor
public interface IInterceptor {
public void execute(AopContext context);
}
AopContext就不必貼出來了
下面來看看配置文件
<beans>
<!
<bean id=
<property name=
<value>net
</property>
<property name=
<ref local=
</property>
<property name=
<list>
<value>dwrAdvisor</value>
</list>
</property>
</bean>
<bean id=
<!
<bean id=
<property name=
<ref local=
</property>
<property name=
<list>
<value>
</list>
</property>
</bean>
<!
<bean id=
<property name=
<list>
<ref bean=
</list>
</property>
</bean>
<!
<bean id=
</beans>
就 這樣
這是一種實現方法
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28021.html