Aug 13th, 2009, 06:51 AM
Sessions between controllers
I'm using a simple spring MVC setup with the webapp being loaded from an embedded Jetty server. I have 1 controller that handles various forms of request by extending MultiActionController. This is the process. The controllers
Load method is called, that loads some details into an object, sticks the object in the session, and then returns to the page to display the results. Some more details are entered and the controllers start method is invoked, which then makes use of the object entered into the session in the Load method.
What I'm finding is that when I open the app in two browsers, I am getting the objects in the session mixed up. Why are the sessions shared between two different browsers? How can I store an object in the session without it getting shared between two browser sessions?
Aug 13th, 2009, 08:34 AM
My assumption you are opening a "new browser" using CTRL+N instead of really opening a new browser by clicking on the icon/menu option. (Although if you use Firefox this is also not going to work because it is detecting the current browser instance).
Aug 13th, 2009, 01:26 PM
You're correct! I didn't realise that double clicking firefox.exe created new browsers in the same process! Thanks very much
Also, I think Jetty allows 255 connections at the same time. Do i need to set the controller to singleton="false" to ensure each connection is served by its own instance of the controller?
Aug 14th, 2009, 03:07 AM
If your controller is stateless it doesn't matter if it is a singleton.