This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing objects in cookies

 
Fritz Largosa
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to store object level information in cookies? From what I understand cookies are limited to storing text level information. If cookies cannot store objects is there another way to store an object in a clients computer? Why would i want to do this? I want to store the objects datatype and not its value alone.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose there's no reason you couldn't serialize an object to a String and then store the string in a cookie. Then, whe you retrieve the cookie, you could de-serialize the string back into an object.
 
M Anderson
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just stuff the object in the HttpSession? It'll be available for the duration of the session only. Unless you're expecting that data to be available forever (or, at least until the user deletes his or her cookies).
 
Fritz Largosa
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, I will look into serializing the object and reconstructing it. Hope it works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic