java - How to get web session on Spring AOP -


i have question using spring aspectj. want create audit log when user , user information web session create audit log. can provide examples of how this?

spring mvc's dispatcherservlet stores request in thread-local variable (if don't use spring mvc, may declare requestcontextlistener in web.xml same thing). variable can accessed via requestcontextholder:

httpsession s = (httpsession) requestcontextholder                     .currentrequestattributes()                     .resolvereference(requestattributes.reference_session); 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -