Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt about attribute listeners

 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to everybody,
I have a doubt about attribute listeners.

Suppose that I have two objects, say A and B, both implementing HttpSessionAttributeListener.

Then, consider the following flow:
1. Add A to session ->A.attributeAdded()
2. Remove A to session -> A.attributeRemoved()
3. Re-add A to session ->A.attributeAdded()
4. Add B to session with the same key of A (I mean, replacing A) -> ???

What happens at point 4?
B.attributeReplaced() should be invoked, but is A.attributeAdded() invoked?
And B.attributeRemoved()?

Thanks in advance.

P.S. I know I could try it, but if I can't find any explaination about my question on the specs and I'm afraid I might find implementation specific behaviours.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
attributeReplaced will be invoked. As attributeReplaced notifies that an attribute has been replaced, HttpSessionBindingEvent#getValue will return the replaced value (which is A).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic