Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ibei.interceptor;
- import java.util.Map;
- import com.opensymphony.xwork2.Action;
- import com.opensymphony.xwork2.ActionInvocation;
- import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
- public class LoginInterceptor extends AbstractInterceptor {
- private static final long serialVersionUID = 1L;
- @Override
- public String intercept(ActionInvocation invocation) throws Exception {
- Map<String,Object> session = invocation.getInvocationContext().getSession();
- String username = (String) session.get("username");
- if(username == null) {
- return Action.LOGIN;
- } else {
- return invocation.invoke();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment