-
Apr 20th, 2011, 06:16 AM
#1
Intercepting methods of Spring controller
Hi,
I was trying to execute some custom code by intercepting the current method of a Controller, checking for a particular annotation. For example,
@Controller
public class MyFormController {
@RequestMapping("/add.do")
public void add(HttpSession session){
// business code
}
@RequestMapping("/remove.do")
@MyCustomAnnotation
public void remove(HttpSession session){
// business code
}
}
my requirement is to intercept each method just before executed, test for the existence of MyCustomAnnotation and take some action.
I have explored HandlerInceptor, but that does not give any access to the current controller method to be executed. I know a generic AOP solution can resolve this. But what I am actually looking for is a Controller specific interceptor that can give me access to the current method being executed.
Any help will be really appreciated.
Tags for this Thread
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