Logout to redirect to UI within root class

Hi,

After reading the guide
here
i tried the following.

getUI().getSession().close();
getUI().getPage().setLocation(request.getContextPath());

What it does is, it redirects to my vaadin root class, which also contains the login UI. The problem is it creates a new session and gets timeout.

What I wanted to do is to redirect back to my vaadin root. Is there any better way to achieve this without the timeout error?

Thanks!

My guess is that request.getContextPath() is just an empty string, with causes setLocation to just reload the page. You could instead test using “/” + request.getContextPath() which should properly redirect to the root of the web application context in all cases.

Hi,

I see. Just to verify again. If it redirects to the root, which is also my vaadin root, it restarts my vaadin app with a new session too?

Yes, reopening a URL that loads a Vaadin UI after closing the session will cause a new session to be opened.

Hi,
I need one help like this.
I want to load MainUI( extends UI) after Login success. Simply I want to load another UI. How to do this. Is it possible…?
Humbly requesting… pls…