What is a Session?

I am testing a Vaadin OSGi whiteboard, so it is not quite standard stuff.

I use VaadinBridge and its servlet which handles requests and I am testing concurrent sessions using Firefox and without thinking too much, just opened a second Firefox process and started doing things on one screen and observing the other.

And getting SYNC errors!

With some debugging, I see that only one instance of the Application is being created and in fact shared between the browser windows. It is easy to see this causes sync errors.

Then I opened another session with IE7, a second session was created as I had thought might happen with two Firefox processes.

Is the problem that session recognition uses cookies and all Firefox processes share the same cookies and this way of testing is not really supported ( Two sessions on the same machine using separate instances of the same browser)?

i.e. What I see is expected behaviour and I should use either different browsers or the same machine or the same browser on different machines?

What does Vaadin need to see to make a new session?

What you see is expected behavior. As far as I know there is at most one instance of application, bound to session id stored in client’s browser cookies.

If you want to open multiple “views” of application in separate browser tabs/windows with the same cookie set, you should look at com.vaadin.Application.getWindow(String) method and override it to create windows dynamically. Keep in mind that these windows will still be attached to the same application instance.

What you see is expected behavior: one application instance is tied to the http session (cookie). And since most browsers use the same session for all tabs/windows, you only get one application.

Most browsers also provide mechanisms to override this, allowing you to get separate sessions per window/tab. But that’s for developers mostly.

What you need to do, if you wish to achieve tabbed-browsing of the same app, is override the Application.getWindow() method. There’s plenty of discussion about tabbed-browsing on the forum. The Sampler source code also provides a simple example:
SamplerApplication.java#L89

Thanks both. It is I expected. I use pop-up dialogs, so you can understand the peculiar effects I can get.

I now test with FF & IE on the same machine to ensure separate sessions.