0 0

Spring 拦截器拦截CONTROLLER后,怎么获取被拦截CONTROLLER的具体方法?5

小弟日前用HandlerInterceptorAdapter 抽象类,完成了CONTROLLER的拦截,但是获取不到被拦截的CONTROLLER的具体被访问的方法。
2013年4月03日 12:40

3个答案 按时间排序 按投票排序

0 0

补充一句,这个功能只有3.1版本之后才有。

HandlerMethod handler2=(HandlerMethod) handler;

2013年4月04日 10:22
0 0

可以把你处理的对象进行转化:例如
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {     
        HandlerMethod handler2=(HandlerMethod) handler;
}
然后根据HandlerMethod就可以了

2013年4月03日 13:33
0 0

preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)

handler--转换成-->org.springframework.web.method.HandlerMethod    再获取

2013年4月03日 13:17

相关推荐

Global site tag (gtag.js) - Google Analytics