To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
my application now only clean session when the session is timeout, i want clean the session immediately after user close window,how to get that event,and how to clean the session in vaadin7.thanks a lot!!
The easy solution is adding a DetachListener to your UI, but it's not 100% reliable -- it's possible to cause a browser window to close without it causing a detach event, although I'm not sure how exactly you'd reproduce that. If those cases are a problem, you'd need to set up a background thread that checks periodically whether the UI is still there and deals with the cleanup if the detach event never happened when it should have. You'd probably need a custom VaadinServlet with overridden createServletService(DeploymentConfiguration) so that you can create your own VaadinServletService in package `com.vaadin.server` in order to access package protected things, and possibly copy over some private helper methods to your own code to get access to everything you need.