• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

serializable object in httpsession

 
Martin Lira
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,
I have a webapp that stores an object (Ex. class Person:String first, last, dob, Address address, etc) in the httpsession. Is it required to make the object implement the serializable interface. I do not have a distributed system.

Are there any pros or cons if i make such objects serializable?

Thanks,
Martin
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only harm in a non-distributed system is that your sessions won't persist over app restarts.

The app server will try to serialize the session object and all nested objects when the server shuts down. If any nested objects do not impliment serializable, the write fails.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic