This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Session Migration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Migration" Watch "Session Migration" New topic
Author

Session Migration

MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
I read one statement regarding session migration that said, "Make sure you session attribute class types are Serializable and you never have to worry about it". Again I read one more statement that said, "The Container is not required to use Serialization so there's no guarantee that readObject() and writeObject() methods will be called on a Serializable attribute."
These two statements made me confused whether to rely on session attributes that implement Serializable interface or to resort to HttpSessionActivationListener interface and use activation/passivation callbacks?


I am slow but sure
Doug Braidwood
Ranch Hand

Joined: Apr 04, 2010
Posts: 42
The Container must migrate any session attributes which are serializable, but it does not have to use serialization to accomplish this.

So if your attributes are all serializable you don't have a problem, but if there are some custom bits that would normally be serialized by writeObject() and readObject() then you will need to work around this as you say with the HttpSessionActivationListener


SCJP, SCWCD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Session Migration
 
Similar Threads
Serialization and the HTTPSession object
Doubts on Http session migration & Serialization
Serializable (?) Objects associated to a session
Doubt about session attribute serialization
global session counter