I was wondering how to preserve an application when the user leave the application completly by going to another site (for example when the user logs into the application and then goes to nytimes.com and then comes back to the application some components go missing). To preserve the application on a refresh you can use the @PreserveOnRefresh annotation, but this does not preserve the application when you leave it. The header, menu and footer are disappearing. These three components are have their own class and are only declared in the main ui. Each view (or page) has its own class (which sit between the menu and the footer). Everything works fine until the user leaves the webpage and comes back the header, menu, and footer disapear So my question is how to preserve my vaadin application when the user leaves it and comes back?
3 Answers
What components are missing when you go back to the application? Vaadin applicaction lives as long as web session. If I go to nytimes.com and then go back before the web session ends, the Vaadin application will survive (if it has @PreserveOnRefresh
) or will be renewed

- 3,900
- 13
- 30

- 4,195
- 1
- 39
- 65
-
The header, menu and footer are disappearing. These three components are have their own class and are only declared in the main ui. Each view (or page) has its own class (which sit between the menu and the footer). Everything works fine until the user leaves the webpage and comes back the header, menu, and footer disapear – abden003 Aug 02 '13 at 15:46
-
I added my main ui to the question – abden003 Aug 06 '13 at 17:49
-
I'm afraid without a complete code I cannot help you. But: do you mean that you work with application, in some moment you open page www.google.com, then you press back browser button and header disappear. What happens when you instead going to google page press reload browser button? – michaldo Aug 06 '13 at 20:31
-
Yes when i press back after visiting another webpage the header disappears, but when I press reload the content does not get affected because of the @PreserveOnRefresh annotation – abden003 Aug 06 '13 at 20:55
-
According to my knowledge it is impossible. You must share your application or part with defect to continue. – michaldo Aug 07 '13 at 07:25
Well, there could be problem with serialization and deserialization from session. Make sure you have implemented Serialization
interface for your own classes.
Have you tried to repaint
the missing components? They should be set to setImmediate(false)
during repaintRequest
.
Anyway, ordinary Vaadin application works without problem after returning back from other url. So good luck.

- 4,133
- 2
- 32
- 49
-
Can you expand or give me links on Serialization? Also The way may app works is that the menu panel, header panel, and footer are in separate classes. When the user logs in three commands are called to build each one. The only part changing in my site is the section between the menupanel and the footer (about 10 different views). When I leave the page and come back everything other than the center piece disappears. Thank you – abden003 Aug 22 '13 at 15:25
-
There is no error at all in your log? It is weird they just disappear. Could you provide more from your implementation and also what's your web container? – Milan Baran Aug 26 '13 at 09:10
To solve this situation you can add a listener to the navigator which will get the uri to the page you are going to and check your permissions. If you do not have permission it will keep you on the same page and give you a notification saying that you are not allowed to go to this page. If they are allowed you will proceed to direct them to that page.

- 1,325
- 7
- 24
- 48