How do I close a vaadin application?

I am embedding a vaadin application into an existing web application. I need to be able to reset the state of the vaadin application every time I load the page with the embedded vaadin application. Currently the vaadin application is remembering the state of the application between http requests.

The only possible solution that I can think of is to close the vaadin application when the web page unloads but what is the best way to do this? I can think of two ways to close the application. One is to make an ajax request that will invalidate the vaadin http session (the vaadin application is in a different ear file from the rest of the application). The other way is if there is a javascript function that is already provided by vaadin. I have not been able to find such a function but if such a function exists I would prefer to use it.

I am not sure how to call that method when the web page that the vaadin application is embedded in is unloaded. That is a java method and is not accessible from javascript.

I found that if I do an ajax request with ?closeApplication at the end of the url it will close the application when the page is unloading it will close the application.

You could listen to window close and call application close when the main window is closed. (yes, you get window close event on server side when user navigates away from your application or closes browser)

Thanks, I like this solution better than making an ajax call when the page is unloaded but the window close listener is getting triggered after I set a div that contains the vaadin div to display: none and then back to block in IE 7.

Actually - Vaadin makes that page unload ajax call for you to be able to call window close listener.


Did you ever find a solution to the IE7 div tag block/none issue and firing of the close event listener for embedded applications? I need to close my application when the page is unloaded, and not before, but the event is firing when div tags - any - are manipulated. Closing the application early causes session expired when accessing the embedded app.

This would seem to be a bug? Is there a workaround?