Wicket 1.5.4 - Shiro LogoutPage.html does not have redirect component added error - with fix #99

jamiemaher opened this Issue Mar 2, 2012 · 0 comments

1 participant



Using Wicket 1.5.4 and wicketstuff-shiro 1.5.4 and I'm getting a error:

I'm mounting the logout page in my Wicket application:

The error is:
"Unable to find component with id 'redirect' in [HtmlHeaderContainer [Component id = _header_0]]"

The source for the logout page contains the meta redirect wicket id, which never seems to be added in the
default PageParameters constructor.

The code contains the following which keeps processing the page (and expects all components to be added):

So I modified the constructor slightly to throw a RestartResponseException instead which works in Wicket 1.5.4:

public LogOutPage(final PageParameters parameters)
        final StringValue page = parameters.get(REDIRECTPAGE_PARAM);
        Class pageClass;
        if (!page.isNull())
                pageClass = (Class)Class.forName(page.toString());
            catch (final ClassNotFoundException e)
                throw new RuntimeException(e);
            pageClass = getApplication().getHomePage();

        // this should remove the cookie...
        final Subject subject = SecurityUtils.getSubject();
        LOG.info("logout: " + subject);
        Session.get().invalidateNow(); // invalidate the wicket session
        //redirect to correct page and stop processing this one.
        throw new RestartResponseException(pageClass);          

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment