How to restart Vaadin session?

2019-05-30 03:59发布

问题:

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.

回答1:

In my project I use this:

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