You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Colin Chalmers <cj...@gmail.com> on 2012/09/11 00:44:26 UTC

Invalidate Session challenges

Hello,

We are using wicket 1.5.8 and Im a little confused how the session
invalidate functionality works.

I have a simple piece of code similiar to the following

        getSession().invalidate();
        setResponsePage(WicketApplication.get().getHomePage());

In general this works fine but during the wicket lifecycle whilst detaching
objects the session.invalidateNow() method is called which destroys the
session and ensures I get the following error

java.lang.IllegalStateException: Cannot create a session after the response
has been committed

If I implement an empty invalidateNow method, or one that refers to my
invalidate method then all appears to work ok

I've seen a couple of posts on this previous but without a definitive answer

Can anyone explain why the invalidateNow method is called within the
lifecycle whilst detaching objects??

Rgds

Colin