I have an authenticator that checks if a user is registered. If it is not redirected to the login page, with the "url" parameter of the query string indicating the referrer URL. I tried using "actionInvocation.getInvocationContext (). GetParameters ()" to pass the values of the redirect URL, but no luck.
Can anyone suggest what I did wrong? Many thanks.
Interceptor Code:
public String intercept(ActionInvocation actionInvocation) throws Exception {
Map session = actionInvocation.getInvocationContext().getSession();
Map params = actionInvocation.getInvocationContext().getParameters();
String user = (String) session.get(Constants.KEY_USER);
boolean isAuthenticated = (null!=user);
if (!isAuthenticated) {
params.put("backUrl", "http://www.some_url.com/");
return Action.LOGIN;
}
else {
return actionInvocation.invoke();
}
}
struts.xml parts
<global-results>
<result name="login" type="redirect">/login?url=${backUrl}</result>
Aries source
share