Search code examples
sessionvaadinrestart

How to restart Vaadin session?


After logout I need to invalidate session and start a new immediately. I used the function

VaadinSession.getCurrent().getSession().invalidate();

After several seconds a red box "Session expired" appears. User must click on it or press F5. How to avoid it and to display new session page immediately?

In javascript is it easy:

document.location='/';

How to do the same in Vaadin? The behavior should be the same as by first visit the page after restarting explorer.


Solution

  • In my project I use this:

    Page.getCurrent().setLocation( "/" );
    VaadinSession.getCurrent().close();