Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC 3.0 HandlerInterceptors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC 3.0 HandlerInterceptors

    Hi,

    I am trying out the HandlerInterceptors from Spring MVC 3.0.

    Below is my interceptor

    --------------------------------------------------------------------------------------------------------
    public class SessionInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandle(HttpServletRequest request,
    HttpServletResponse response, Object handler) throws Exception {
    System.out.println("inside preHandle");
    if(request.getSession().getAttribute(SessionConsta nts.USER_SESSION_NAME) == null) {
    response.sendRedirect("welcome");
    return false;
    }
    return true;
    }
    }
    ----------------------------------------------------------------------------------------------------------
    Below is my configuration in my xml

    <mvc:annotation-driven/>

    <mvc:interceptors>
    <mvc:interceptor>
    <mvc:mapping path="/services/*"/>
    <bean class="com.ca.myca.interceptors.SessionInterceptor " />
    </mvc:interceptor>
    </mvc:interceptors>

    But the interceptor is not getting called.

    Please let me know if I am missing any thing.

    Thanks
    GNR

  • #2
    Please use [ code][/code ] tags when posting code, that way it remains readable.

    Which URL are you requesting and when do you expect the interceptor to be invoked.

    Comment

    Working...
    X