1 /*****************************************************************************
5 * Creation date 10.01.2013
8 * @copyright OPEN CASCADE 2012-2015
9 *****************************************************************************/
11 package org.splat.simer;
13 import org.splat.log.AppLogger;
15 import com.opensymphony.xwork2.ActionInvocation;
16 import com.opensymphony.xwork2.interceptor.Interceptor;
19 * The interceptor that redirect to a page after login.
21 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
24 public abstract class AbstractRedirectAfterLoginInterceptor implements
30 protected final static AppLogger LOG = AppLogger
31 .getLogger(AbstractRedirectAfterLoginInterceptor.class);
36 private String _globalResult;
39 * Get the globalResult.
41 * @return the globalResult
43 public String getGlobalResult() {
48 * Set the globalResult.
51 * the globalResult to set
53 public void setGlobalResult(final String globalResult) {
54 _globalResult = globalResult;
60 * @see com.opensymphony.xwork2.interceptor.Interceptor#destroy()
62 public void destroy() {
63 LOG.debug("RedirectAfterLoginInterceptor destroyed.");
69 * @see com.opensymphony.xwork2.interceptor.Interceptor#init()
72 LOG.debug("RedirectAfterLoginInterceptor initialized.");
78 * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
80 public String intercept(final ActionInvocation invocation) throws Exception { //NOPMD: RKV: because of struts invoke() method
81 LOG.debug("RedirectAfterLoginInterceptor before rendering.");
83 String result = getGlobalResult();
85 if (redirectCondition(invocation)) {
86 LOG.debug("RedirectAfterLoginInterceptor Redirection Needed");
88 result = invocation.invoke();
90 LOG.debug("RedirectAfterLoginInterceptor after rendering.");
95 * Return true if it must to redirect on the global result.
99 * @return boolean true if we need to redirect to the global result
103 protected abstract boolean redirectCondition(
104 final ActionInvocation invocation) throws Exception; //NOPMD: RKV: because of struts invoke() method