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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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