spring mvc dispatcherservlet处理request流程

it2022-05-05  120

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());

转载于:https://www.cnblogs.com/panxuejun/p/7149652.html


最新回复(0)