📄 sessioninterceptor.java
字号:
/**
*
*/
package com.sunwah.baseapp.interceptor;
import java.util.Map;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.sunwah.baseapp.common.Constants;
/**
* 登录拦截器
*
* @author MARK
*
*/
public class SessionInterceptor implements Interceptor {
/**
*
*/
private static final long serialVersionUID = -5155109641818958779L;
public void destroy() {
}
public void init() {
}
public String intercept(ActionInvocation actionInvocation) throws Exception {
Map session = actionInvocation.getInvocationContext().getSession();
Object obj = session.get(Constants.SESSION_USER);
// 判断用户是否登录
if (obj == null)
return Action.LOGIN;
return actionInvocation.invoke();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -