Creating multiple UI instances when prefetching in chrome is enabled


I am currently migrating my application from Vaadin 6 to Vaadin 7. I wanted to change as less as possible. But now I ran into an issue I can’t solve properly.

In my old application I’ve created a RequestHandler which checked the path in my request and changed the view accordingly. In Vaadin 7 I 've added a RequestHandler (with the mentioned functionality) which I add when initializing the session.

My UI instance has the @PreserveOnRefresh-Flag so that on refreshes the old UI is used.
Now if I change the path of my url, I want to use the same UI which works properly if the prefetch-flag of my Chrome browser is disabled. If it is enabled, the browser sends a request which results in a new UI instance inside the same session. Unfortunately, multipe UI instances inside one session have unwanted side effects.

I don’t have any ideas how to solve the problem. For example, Chrome does not send a header to distinguish between prefetch and normal request. Or am I completely wrong and need a different approach to my problem?

Any help would be appreciated!


can’t help with your actual problem, but “multipe UI instances inside one session have unwanted side effects” sounds quite bad design to me since users can easily open multiple browser windows (or tabs) and create multiple UI instances inside the same session anyway.