Hi, I have a RestartResponseAtInterceptPageException working correctly in
one case and not so in another.

I have a Login page with a LoginForm. In this form's onSubmit method, right
after the user validation takes place, I have:

if(!continueToOriginalDestination()) {
    setResponsePage(Dashboard.class);
}

When this is called form the following Page, it works correctly (the users
gets redirected to the Login page, and once he logs in correctly, he is
redirected back to the page below):
public class PublishItem {
public PublishItem() {
if(!UserLoggedInSession.get().isLoggedIn()) {
UserLoggedInSession.get().getFeedbackMessages().add(getPage(), "You need to
Sign in before you can publish!", FeedbackMessage.INFO);
throw new RestartResponseAtInterceptPageException(Login.class);
}
}
}

However, when this same logics is applied from within a Link's onClick
method, it does not work:
AnotherPage.java
Link signinLink = new Link("siginLink") {
public void onClick() {
UserLoggedInSession.get().getFeedbackMessages().add(getPage(), "Signin
before adding a comment!", FeedbackMessage.INFO);
            throw new RestartResponseAtInterceptPageException(Login.class);
}
};
signinLink.setVisible(!userLoggedIn);
add(signinLink);

In this second case, the user does get redirected to the Login page, and
once the correct username/password combination is entered, he actually logs
into the system. The problem is that the Login page simply refreshes, and
does not get redirected back to AnotherPage.java

Any help is appreciated.
Thanks.

Reply via email to