Docs

Documentation versions (currently viewingVaadin 24)

Using Sessions with MPR

The state of the UI in an MPR project is managed by the com.vaadin.flow.server.VaadinSession class. However, the methods from the legacy com.vaadin.server.VaadinSession class can also be used, since both wrap the same jakarta.servlet.http.HttpSession.

Invalidating a Session

To invalidate a session — and possibly start a new one — you can invalidate the session managed by Flow and reload the page.

Below is an example of this:

Button close = new Button("Close session", event -> {
    UI.getCurrent().getPage().reload();
    VaadinSession.getCurrent().getSession().invalidate();
});

4AACE081-AFEE-4522-A491-4EC6FC4C9C05