• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to intercept a "getSession" method?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have the following scenario:

---When any method is called I would like to set the user logged in the session before its execution---

I am using Spring + Hibernate. In the "applicationContext.xml" I configured as follows:



I've tried that by implementing the interface Filter like this:



But, it does not work, because if a method calls another methods the user logged is not setted. Any ideas?

Thanks in advance!
 
Author
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rafael,

I think you'd want to look at the JavaEE HttpSessionListener functionality, which will notify you when sessions are created and destroyed. You configure this in your deployment descriptor (web.xml)

Best,
Peter
 
Rafael F. Oliveira
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, Your suggestion is related to http sessions, How can I intercept the Hibernate Session (openSession method)?

[]'s
 
Peter Mularien
Author
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that confusion, it wasn't clear in your original question that was what you meant. Can you post the source of the setUserLogged method, and clearly indicate what is not working as you expect?
 
Rafael F. Oliveira
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is necessary because we have a legacy application...



[]'s
 
reply
    Bookmark Topic Watch Topic
  • New Topic