wood burning stoves 2.0*
The moose likes Servlets and the fly likes Object cloning in HTTPSession? 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 "Object cloning in HTTPSession?" Watch "Object cloning in HTTPSession?" New topic
Author

Object cloning in HTTPSession?

Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247



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?

SCJP 6 [SCJP - Old is Gold]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
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

 
wood burning stoves
 
subject: Object cloning in HTTPSession?
 
Similar Threads
HttpSession.invalidate() method
Bean values won't change on form submit
Will tomcat creates a new session for every forward to a jsp page
Life of Idempotency
lastAccessTime for HttpSession