On Tue, 13 Jul 1999, Chris Means wrote:
>
> 1)  As we're storing actual objects in the HttpSession object, if we use
> getValue and modify the object (properties) do we still need to use
> putValue? Why, aren't we dealing with another reference to the same object?
We are storing object references in HttpSession, not "actual objects".
The getValue(String key) does not remove the value stored, and does not
return a clone of it.

>
> 2)  If the answer to #1 is yes, then does that mean that getValue actually
> performs a removeValue?  (I would think not, but I want to make sure.)
No. putValue(String key, Object newValue)  removes (un-bounds) the
previous value stored with the given key, if it exists in HttpSession.

So you should expect your object to be un-bound and immediatly re-bound
each time you put it with the same "key" within HttpSession.

Dont know if such optimisations are common or allowed:
HttpSession just check first the newValue is the same Object refference
as oldValue and does nothing (no actual put() needed, the object is
already bound under the given key)

>
> 3)  If the object used in the putValue call implements
> HttpSessionBindingListener, does the valueBound method for that object get
> called each time the object is 'put' into the HttpSession or only the first
> time (it's not already there)?  And then does it mean that the valueUnbound
> method is called for a getValue call?
>
> Thanks for any help clearing up my confusion here.
>
> If there's anything I'm neglecting here regarding these issues, please let
> me know.
>
> Thanks.
>
> -Chris Means
> mailto:[EMAIL PROTECTED]
> ICQ: 36475838
> Empower Geographics, Inc.
> Visit us at:  http://www.empowergeo.com
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to