Announcement Announcement Module
Collapse
No announcement yet.
Intercepting methods of Spring controller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.
Working...
X