Multiple sessions

Hi Experts,

Am facing an issue, how can I handle multiple sessions? Please suggest

I have developed a Login page and Main page, Now when I open a browser and login through login window and now I open another browser and now my I should be in the login page but, currently am being taken to main page. Can someone help me on this ?

Thanks,
Arun

Not an expert, but we use following template for our Application:

And the MyApplicationWindow class:

There are some essential parts to this (if I remember correctly, we haven’t touch this part of the code for over a year I think):-

  • Multiple application instances are managed thourhg a combination of thread-local and the HttpRequestListener, to switch to the correct instance based on the request (if there is connection pooling going on for example).
  • getWindow() creates a new Application Window if there isn’t one yet
  • the application window can get a reference to the corresponding Application instance via the getApplication method.
  • the application window can then retrieve all state for that application (like is there already a user logged in, etc.) to show the correct screen

I changed the code to pseudo code, so it might not be entirely syntactically correct, but it hopefully gives you some pointers on where to look for more information.
The multiple application stuff might not be required for your use case, but it makes the picture more complete, since you will end up with multiple applications in case you have multiple sessions, and you will probably have application code that needs to get a handle to the associated Application instance.

If you’re using 2 browsers, then you have 2 sessions. There’s no way for more than one browser to share the same session (without some serious hacking around!). Are you sure you mean a separate browser and not a separate tab in the same browser?

If you’re seeing the same info in more than one session, then there’s some problem in your app that you’re not storing data properly within the Vaadin application object. Are you using any static variables? That would lead to the kind of behavior you’re seeing.

Cheers,
Bobby