Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to intercept a "getSession" method?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
It is necessary because we have a legacy application...



[]'s
 
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic