• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object cloning in HTTPSession?

 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


After binding of instance 'a' in session, StringBuffer instance is updated after appending... But this change wont be impacted on object in the session... Output of instance fetched from Session will be only "java"... It will be impacted only if the updated object is rebinded again in Session...

Why the append operation is not reflected on object in session?... Does object cloning occur in HTTPSession?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly what did you do to get this result?

During one request, both the local and session references should point to the same object.

IF the servlet container wants to, it can serialize the session to disk. When it is read back in for a subsequent request a new StringBuffer object will be created.

Bill

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic