Guest User

Untitled

a guest
Jan 10th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package ibei.interceptor;
  2.  
  3. import java.util.Map;
  4.  
  5. import com.opensymphony.xwork2.Action;
  6. import com.opensymphony.xwork2.ActionInvocation;
  7. import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
  8.  
  9.  
  10. public class LoginInterceptor extends AbstractInterceptor {
  11.  
  12. private static final long serialVersionUID = 1L;
  13.  
  14. @Override
  15. public String intercept(ActionInvocation invocation) throws Exception {
  16. Map<String,Object> session = invocation.getInvocationContext().getSession();
  17.  
  18. String username = (String) session.get("username");
  19.  
  20. if(username == null) {
  21. return Action.LOGIN;
  22. } else {
  23. return invocation.invoke();
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment