spring mvc dispatcherservlet处理request流程

1.dispatcherservlet接收到请求后,doDispatch(request,response)

2.doDispatch()里进行handlermapping,handlermapping根据入参httprequest,返回结果是HandlerExecutionChain,HandlerExecutionChain里包含handlerAdaptor(controller)

//HandlerExecutionChain有个gethandler()方法,可以直接拿到handler

spring mvc源码

// Determine handler for the current request.
HandlerExecutionChain mappedHandler = getHandler(processedRequest);

if (mappedHandler == null || mappedHandler.getHandler() == null) {
noHandlerFound(processedRequest, response);
return;
}

//HandlerExecutionChain有个gethandler()方法,可以直接拿到handler

// Determine handler adapter for the current request.
HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());

posted @ 2017-07-11 11:20  跨境电商杂货铺  阅读(366)  评论(0编辑  收藏  举报