| | |
| | | package com.yeshi.buwan.interceptor; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import com.opensymphony.xwork2.ActionContext; |
| | | import com.opensymphony.xwork2.ActionInvocation; |
| | | import com.opensymphony.xwork2.interceptor.AbstractInterceptor; |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | |
| | | public class LoginInterceptor extends AbstractInterceptor { |
| | | public class LoginInterceptor { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Override |
| | | public String intercept(ActionInvocation invocation) throws Exception { |
| | | ActionContext ctx = invocation.getInvocationContext(); |
| | | Map<String, Object> session = ctx.getSession(); |
| | | AdminInfo info = (AdminInfo) session.get("ADMIN_INFO"); |
| | | if (info == null) { |
| | | return "login"; |
| | | } else { |
| | | return invocation.invoke(); |
| | | } |
| | | } |
| | | // |
| | | // @Override |
| | | // public String intercept(ActionInvocation invocation) throws Exception { |
| | | // ActionContext ctx = invocation.getInvocationContext(); |
| | | // Map<String, Object> session = ctx.getSession(); |
| | | // AdminInfo info = (AdminInfo) session.get("ADMIN_INFO"); |
| | | // if (info == null) { |
| | | // return "login"; |
| | | // } else { |
| | | // return invocation.invoke(); |
| | | // } |
| | | // } |
| | | } |