Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

HttpSessionBindingListener Interface

 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody help me out in understanding a practical example for implementing a HttpSessionBindingListener Interface?(when you have HttpSessionAttributeListener)


There is one more thing that you don't have to make a entry in web.xml for the same (alike other Listeners) why it is so?

Thanx in Advance

Shrinivas
 
Shrinivas Mujumdar
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agreed!!!
Now what is the practical example of using HttpSessionBindingListener?

Shrinivas
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

There is one more thing that you don't have to make a entry in web.xml for the same (alike other Listeners) why it is so?


The reason is that when an object is added to or removed from any session, the container introspects the interfaces implemented by that object. If the object implements the HttpSessionBindingListener interface, the container invokes the valueBound or valueUnbound methods respectively. These methods are called even if the session is explicitly invalidated or timed out. The arg passed into the methods is of type HttpSessionBindingEvent.

The developer can do various things in these methods. For instance, in valueBound the HttpSession associated with the HttpSessionBindingEvent can be obtained.
 
Pradeep bhatt
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shrinivas Mujumdar:
Agreed!!!
Now what is the practical example of using HttpSessionBindingListener?

Shrinivas



Consider this : If session timeout and login info is stored as HttpSessionBindingListener object the value unbound method will be called. You could this method for example log some auditing messages that user has been logged out because of timeout.
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic