I have a wicket (6.22) web application. I need to perform automatic redirection to an external URL. The scenario is described bellow:
I did use "renderHead" function to add tag
<meta http-equiv="refresh" content="5; url=http://example.com">
The issue is that I need to invalidate the session before the redirection. If I do so, the customers are redirected to my ExpiredSession page instead of the external URL.
Is their any clean solution to make it happend?
Thank you for your help
Instead of using <meta http-equiv="refresh" content="5; url=http://example.com">
you can set up an Ajax behavior that will: 1) invalidate the session; 2) redirect to the external page
anyComponent.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
@Override protected void onTimer(AjaxRequestTarget target) {
getSession().invalidate();
throw new RedirectToUrlException("https://external.page");
}
});