How to use setLogoutUrl & close


I try to redirect users when the close() method is called.

I add this.setLogoutUrl(url) in the init() method but when close() was called, the redirection doesn’t work.

I try to call :


on logout button and it’s work perfectly.

I also try to call this code after a duration and it doesn’t work.

So what is the best way to use this?




If you want that your application does a URL redirection on session expiration, you have to add the following kind of static method to your application class:

public static SystemMessages getSystemMessages() {
	CustomizedSystemMessages m = new CustomizedSystemMessages();
	return m;


Thanks for your response. It work perfectly when we have a Refresher but have no effect when refresher sleep (for exemple, on login page). So it’s a part of the solution :slight_smile:

has anybody a nice solution how to set the SessionExpiredURL containing the current context path ?
Lets say I have another servlet inside my vaadin app.

m.setSessionExpiredURL(contextPath + "/otherServletUrl");

I can find no way to access the context path in the static method.
I’ve stored it in an ThreadLocal, but after the session is lost, the thread is lost.

Probably this should be part of CustomizedSystemMessages


So the vaadin Servlet knows where to redirect.

Any other solutions or workarounds ?


No need to set any additional flag, me thinks it’s totally possible to detect that from the URL itself. Otherwise a very good request/enhancement.

Edit. Worth a ticket, me thinks also.

[quote=Jouni Koivuviita]
No need to set any additional flag, me thinks it’s totally possible to detect that from the URL itself.

Edit. Worth a ticket, me thinks also.
[/quote]Can you create the ticket please, I think your tickets got more power :wink:

:slight_smile: I wish, but unfortunately not. All tickets are handled similarly regardless of the reporter, based on severity and priority.

Question: did you actually try the session expiration with a relative URL, and it didn’t work?

Yes, if I omit the contextPath the AbstractApplicationServlet redirects to “/otherServletUrl” (without contextPath).
See: AbstractApplicationServlet.handleServiceSessionExpired

The contextPath should actually by added to all static SystemMessages (sessionExpiredURL, communicationErrorURL, internalErrorURL, outOfSyncURL, cookiesDisabledURL).