Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpSessionBindingListener and Session.setAttribute  RSS feed

Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all.
I have a doubt about HttpSessionBindingListener
and session.setAttribute( name, attrib )

The API says

In the implementation I have a log message to see if the method get called

I've wrote a message in the constructor as well to see when a new Object is created.
The first time I call the servlet through the POST method the messages appear in the console, but If I do refresh valueBound message does not appears even though the constructor message does ( by the way the servlet get called within a form and when I do refresh the Browser ask if I want to re-send the data and I click ok ;P )

This means that a new Object is created and setted on the session with the same name, according with the API the session should replace the existing attribute with the new one Im I right ???
Is this behavior the correct ?

By the way , the session calls hashCode and equals on the existing object when the new one is tryed to be set on the session and IMHO as the object is the same ( according with hashCode and equals() ) the session refuses to replace it thus valueBound and valueUnbound are never called.

Im using WebLogic Server 6.1 and I don't know if this issue is related only to that version but as I want my aplication to be portable and be usable in other app servers I would like to hear if someone knows if this should be the correct behavior or is exclusive to WLS

Thank you kn advance.
[ December 30, 2002: Message edited by: Zkr Ryz ]
[ December 30, 2002: Message edited by: Zkr Ryz ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!