Interceptor 实现
public interface Interceptor extends Serializable {
void destroy();
void init();
String intercept(ActionInvocation invocation) throws Exception;}
The init method is called the after interceptor is instantiated and before calling intercept. This is the place to allocate any resources used by the interceptor.
The intercept method is where the interceptor code is written. Just like an action method,intercept returns a result used by Struts to forward the request to another web resource. Calling invoke on the parameter of type ActionInvocation will execute the action (if this is the last interceptor on the stack) or another interceptor.
init()方法在拦截器被初始化intercept()方法调用之前被调用。intercept()写在拦截器实现类中,当invoke()调用ActionInvocation 参数中的invoke()时会执行action或者下一个拦截器。
PreResultListener接口
Keep in mind that invoke will return after the result has been called (eg. after you JSP has been rendered), making it perfect for things like open-session-in-view patterns.If you want to do something before the result gets called, you should implement a PreResultListener.
线程安全