2

I have an aspect class used to log the application, and I need information that's in the user session. Is there any way to provide the HttpSession for the aspect, or its attributes?

Thanks for any help.

Juliano Alves
  • 2,006
  • 4
  • 35
  • 37

2 Answers2

2

If you are using Sring MVC , the information is stored in the RequestContextHolder For Security you have the info in the SecurityContext .Check here for more info .

Community
  • 1
  • 1
Aravind A
  • 9,507
  • 4
  • 36
  • 45
1

If you pass the HttpSession as a parameter it can be used by the advice:

@Before("args(httpSession,..)")
public void logHttpSession(HttpSession httpSession) {
    ...
}
CKuck
  • 702
  • 5
  • 18