Spring MVC HandlerMapping

http://www.cnblogs.com/tengyunhao/p/7658952.html

http://www.cnblogs.com/tengyunhao/p/7518481.html

Spring MVC中的 HandlerMapping 是请求到处理器映射,即请求的URL到Controller的映射,通过URL找到响应的Controlelr控制器。

作用是根据当前请求的找到对应的Handler,并将Handler与一堆HandlerInterceptor(拦截器)封装到HandlerExceutionChain对象中。在HandlerMapping接口的内部只有一个方法,如下:

  HandlerExecutionChain getHandler(HttpServletRequest request)

HandlerMapping 是由 DispatcherServlet 调用,DispatcherServlet 会从容器中取出所有HandlerMapping 实例并遍历,让 HandlerMapping 实例根据自己实现类的方式去尝试查找 Handler。

 

HandlerExecutionChain 对象

猜你喜欢

转载自www.cnblogs.com/natian-ws/p/10859771.html