1 /*****************************************************************************
5 * Creation date 10.01.2013
8 * @copyright OPEN CASCADE 2012
9 *****************************************************************************/
11 package org.splat.simer;
13 import org.apache.struts2.ServletActionContext;
15 import com.opensymphony.xwork2.ActionInvocation;
18 * Redirect to a globalResult if the session has been invalidated.
20 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
23 public class SimanRedirectOnEndOfSessionInterceptor extends
24 AbstractRedirectAfterLoginInterceptor {
29 private static final long serialVersionUID = -2669940721820416684L;
36 * globalResultActionName.
38 private String _globalResultActionName;
41 * Get the globalResultActionName.
43 * @return the globalResultActionName
45 public String getGlobalResultActionName() {
46 return _globalResultActionName;
50 * Set the globalResultActionName.
52 * @param globalResultActionName
53 * the globalResultActionName to set
55 public void setGlobalResultActionName(final String globalResultActionName) {
56 _globalResultActionName = globalResultActionName;
62 * @see org.splat.simer.AbstractRedirectAfterLoginInterceptor#redirectCondition(com.opensymphony.xwork2.ActionInvocation)
65 protected boolean redirectCondition(final ActionInvocation invocation)
66 throws Exception { // NOPMD: RKV: because of struts invoke() method
67 String action = invocation.getInvocationContext().getName();
68 boolean doRedirect = (!"index".equals(action));
69 if (LOG.isDebugEnabled()) {
70 LOG.debug("Entering redirectCondition Test: " + action);
72 .debug("Do redirection: "
73 + (doRedirect && (ServletActionContext.getRequest()
74 .getSession().getAttribute(
75 Action.USER_RIGHTS) == null)));
77 return (doRedirect && (ServletActionContext.getRequest().getSession()
78 .getAttribute(Action.USER_RIGHTS) == null));