📄 downloadinterceptor.java
字号:
package org.wiely.interceptor;
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
/**
* DowLoadInterceptor implements Interceptor
* when the visitors download the resources ,he must be user,or the page
* is redirect to the index.jsp.
*/
@SuppressWarnings("serial")
public class DownLoadInterceptor implements Interceptor {
@Override
public void destroy() {
}
@Override
public void init() {
}
@SuppressWarnings("unchecked")
@Override
public String intercept(ActionInvocation invocation) throws Exception {
Map session = ActionContext.getContext().getSession();
if (session.get("user") == null) {
return "userlogin";
} else {
return invocation.invoke();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -