码迷,mamicode.com
首页 > 编程语言 > 详细

SpringMVC之HandlerAdapter执行流程

时间:2018-09-10 21:53:05      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:tor   oid   process   dispatch   config   tin   自定义   view   hand   

01.
protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Exception {
HandlerAdapter ha = this.getHandlerAdapter(mappedHandler.getHandler());
ha = (HandlerAdapter)var2.next();
}

02.
protected HandlerAdapter getHandlerAdapter(Object handler) throws ServletException {
Iterator var2 = this.handlerAdapters.iterator();

HandlerAdapter ha;
do {
if (!var2.hasNext()) {
throw new ServletException("No adapter for handler [" + handler + "]: The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler");
}

ha = (HandlerAdapter)var2.next();
if (this.logger.isTraceEnabled()) {
this.logger.trace("Testing handler adapter [" + ha + "]");
}
} while(!ha.supports(handler));

return ha;
}

03.
mv = ha.handle(processedRequest, response, mappedHandler.getHandler());
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
return ((Controller)handler).handleRequest(request, response);
}

04.自定义的Controller

SpringMVC之HandlerAdapter执行流程

标签:tor   oid   process   dispatch   config   tin   自定义   view   hand   

原文地址:https://www.cnblogs.com/jinyanbin/p/9623092.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!