-
Mar 22nd, 2007, 12:04 PM
#1
Getting Session in AOP beforeAdvice methodI
I need to develop a service which can authenticate user if he is already logged in before going to any other page. I am setting an attribute in session for this once the user is logged in.
My question is, is there any way I can get Session object in beforeAdvice method of Spring AOP, so that I can access attribute for authentication.
any reply much appreciated.
-artofabhi
-
Mar 24th, 2007, 06:30 AM
#2
I would implement this with a ServletFilter, this way you have access to all the stuff in the request and session. Use the DelegatingFilterProxy so that you can configure your Filter as a normal Spring bean.
If you really need to or want to implement it as an Aspect I would also suggest that you define a filter. That filter will put the desired parameter in a ThreadLocal, that way you can retrieve the proper value from inside the Aspect.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules