Spring HandlerInterceptorAdapter prehandle RequestDispatcher not forwarding
my problem is as the title mention, I'm trying to foward a request during
the HandlerInterceptorAdapter prehandle function, however the prehandle
seems to be picking up the response url everytime.
@Override public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
if (handler != null)
{
HandlerMethod h = (HandlerMethod) handler;
if( h.getMethod().isAnnotationPresent(A.class) )
{
Annotation a = h.getMethodAnnotation(A.class);
if (a!= null)
{
if( !"code".equals(a.getCode()) )
{
RequestDispatcher rd =
request.getRequestDispatcher(request.getContextPath() +
"/pathToView");
rd.forward(request, response);
return false;
}
}
}
return true;
}
}
No comments:
Post a Comment