Spring mvc interceptor exception
My project is baded on spring mvc, and I wrote a interceptor to intercept
request, I want to get parametrts from request, the follows is my code:
public boolean preHandle(HttpServletRequest request, HttpServletResponse
response, Object handler) throws Exception {
HandlerMethod maControl = (HandlerMethod) handler;
Method pmrResolver = (Method) maControl.getMethod();
String methodName = pmrResolver.getName();
....
}
but now it throws a exception:
java.lang.ClassCastException:
org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler
cannot be cast to org.springframework.web.method.HandlerMethod
I don't know why, I have configured in web.xml to avoid intercept static
source.
No comments:
Post a Comment