深圳市国外网站建设服务机构,电子商务未来发展趋势前景,做暧暧暧昧网站,投资1、处理流程图展示
当我拿出这张图#xff0c;阁下又该如何应对呢#xff1f;执行流程是不是一目了然了。【记住一句话#xff1a;所有的注解都只是一个标签或者标记#xff0c;最终都是反射找到具体方法上面的注解标记#xff0c;然后找到类、属性、方法扩展自己想要的功…1、处理流程图展示
当我拿出这张图阁下又该如何应对呢执行流程是不是一目了然了。【记住一句话所有的注解都只是一个标签或者标记最终都是反射找到具体方法上面的注解标记然后找到类、属性、方法扩展自己想要的功能功能。】
2、DispatcherServlet中央处理器或者中央调度器 下图官方的解释应该最完善了。
3、SpringMVC三大核心组件 HandlerMapping 处理器映射器作用是解析URL返回执行链以及一些列所需的拦截器DispatcherServlet源代码1030行的doDispatch(HttpServletRequest request, HttpServletResponse response)方法里面清晰地展示了执行流程大家有兴趣了可以去看看就是一个方法套方法的执行链条最终将请求进行处理直到返回ModelAndView。
/*** Process the actual dispatching to the handler.* pThe handler will be obtained by applying the servlets HandlerMappings in order.* The HandlerAdapter will be obtained by querying the servlets installed HandlerAdapters* to find the first that supports the handler class.* pAll HTTP methods are handled by this method. Its up to HandlerAdapters or handlers* themselves to decide which methods are acceptable.* param request current HTTP request* param response current HTTP response* throws Exception in case of any kind of processing failure*/SuppressWarnings(deprecation)// 最核心的请求、响应处理方法protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Exception //封装好的请求实例HttpServletRequest processedRequest request;// 处理器执行责任链HandlerExecutionChain mappedHandler null;//是否是多媒体文件请求boolean multipartRequestParsed false;//WebAsyncManager asyncManager WebAsyncUtils.getAsyncManager(request);try {ModelAndView mv null;Exception dispatchException null;try {processedRequest checkMultipart(request);multipartRequestParsed (processedRequest ! request);// 传递请求最终初始化处理器映射器mappedHandler getHandler(processedRequest);if (mappedHandler null) {noHandlerFound(processedRequest, response);return;}// 根据前面的处理器映射器初始化处理器适配器HandlerAdapter ha getHandlerAdapter(mappedHandler.getHandler());// 拿到请求方式String method request.getMethod();//是否是GET请求boolean isGet HttpMethod.GET.matches(method);if (isGet || HttpMethod.HEAD.matches(method)) {long lastModified ha.getLastModified(request, mappedHandler.getHandler());if (new ServletWebRequest(request, response).checkNotModified(lastModified) isGet) {return;}}if (!mappedHandler.applyPreHandle(processedRequest, response)) {return;}// 真正的处理请求并返回模型和视图mv ha.handle(processedRequest, response, mappedHandler.getHandler());if (asyncManager.isConcurrentHandlingStarted()) {return;}applyDefaultViewName(processedRequest, mv);mappedHandler.applyPostHandle(processedRequest, response, mv);}catch (Exception ex) {dispatchException ex;}catch (Throwable err) {// As of 4.3, were processing Errors thrown from handler methods as well,// making them available for ExceptionHandler methods and other scenarios.dispatchException new NestedServletException(Handler dispatch failed, err);}// 封装视图结果processDispatchResult(processedRequest, response, mappedHandler, mv, dispatchException);}catch (Exception ex) {triggerAfterCompletion(processedRequest, response, mappedHandler, ex);}catch (Throwable err) {triggerAfterCompletion(processedRequest, response, mappedHandler,new NestedServletException(Handler processing failed, err));}finally {if (asyncManager.isConcurrentHandlingStarted()) {// Instead of postHandle and afterCompletionif (mappedHandler ! null) {mappedHandler.applyAfterConcurrentHandlingStarted(processedRequest, response);}}else {// Clean up any resources used by a multipart request.if (multipartRequestParsed) {cleanupMultipart(processedRequest);}}}} HandlerAdapter 处理器适配器 ViewResolver 视图解析器 文章转载自: http://www.morning.dbqcw.com.gov.cn.dbqcw.com http://www.morning.smxyw.cn.gov.cn.smxyw.cn http://www.morning.mfsxd.cn.gov.cn.mfsxd.cn http://www.morning.hmpxn.cn.gov.cn.hmpxn.cn http://www.morning.dmwjl.cn.gov.cn.dmwjl.cn http://www.morning.jgcxh.cn.gov.cn.jgcxh.cn http://www.morning.rwzmz.cn.gov.cn.rwzmz.cn http://www.morning.ykmtz.cn.gov.cn.ykmtz.cn http://www.morning.nbgfk.cn.gov.cn.nbgfk.cn http://www.morning.fy974.cn.gov.cn.fy974.cn http://www.morning.qinhuangdjy.cn.gov.cn.qinhuangdjy.cn http://www.morning.fnbtn.cn.gov.cn.fnbtn.cn http://www.morning.gmrxh.cn.gov.cn.gmrxh.cn http://www.morning.hdscx.cn.gov.cn.hdscx.cn http://www.morning.khclr.cn.gov.cn.khclr.cn http://www.morning.rwnx.cn.gov.cn.rwnx.cn http://www.morning.rfjmy.cn.gov.cn.rfjmy.cn http://www.morning.mrxqd.cn.gov.cn.mrxqd.cn http://www.morning.fpbj.cn.gov.cn.fpbj.cn http://www.morning.knnc.cn.gov.cn.knnc.cn http://www.morning.rldph.cn.gov.cn.rldph.cn http://www.morning.pjqxk.cn.gov.cn.pjqxk.cn http://www.morning.sryyt.cn.gov.cn.sryyt.cn http://www.morning.fktlg.cn.gov.cn.fktlg.cn http://www.morning.csgwd.cn.gov.cn.csgwd.cn http://www.morning.ydnx.cn.gov.cn.ydnx.cn http://www.morning.nccyc.cn.gov.cn.nccyc.cn http://www.morning.kcsx.cn.gov.cn.kcsx.cn http://www.morning.qszyd.cn.gov.cn.qszyd.cn http://www.morning.pcgrq.cn.gov.cn.pcgrq.cn http://www.morning.xstfp.cn.gov.cn.xstfp.cn http://www.morning.wtdyq.cn.gov.cn.wtdyq.cn http://www.morning.kjfsd.cn.gov.cn.kjfsd.cn http://www.morning.msgnx.cn.gov.cn.msgnx.cn http://www.morning.ssjee.cn.gov.cn.ssjee.cn http://www.morning.gmmxh.cn.gov.cn.gmmxh.cn http://www.morning.ntqjh.cn.gov.cn.ntqjh.cn http://www.morning.tphrx.cn.gov.cn.tphrx.cn http://www.morning.nd-test.com.gov.cn.nd-test.com http://www.morning.tzrmp.cn.gov.cn.tzrmp.cn http://www.morning.rdnjc.cn.gov.cn.rdnjc.cn http://www.morning.rxwnc.cn.gov.cn.rxwnc.cn http://www.morning.kfmlf.cn.gov.cn.kfmlf.cn http://www.morning.tgbx.cn.gov.cn.tgbx.cn http://www.morning.wgxtz.cn.gov.cn.wgxtz.cn http://www.morning.htbbp.cn.gov.cn.htbbp.cn http://www.morning.rxfgh.cn.gov.cn.rxfgh.cn http://www.morning.wqnc.cn.gov.cn.wqnc.cn http://www.morning.clyhq.cn.gov.cn.clyhq.cn http://www.morning.ljcf.cn.gov.cn.ljcf.cn http://www.morning.sxygc.cn.gov.cn.sxygc.cn http://www.morning.frnjm.cn.gov.cn.frnjm.cn http://www.morning.fslxc.cn.gov.cn.fslxc.cn http://www.morning.qljxm.cn.gov.cn.qljxm.cn http://www.morning.hqwtm.cn.gov.cn.hqwtm.cn http://www.morning.bpcf.cn.gov.cn.bpcf.cn http://www.morning.fjntg.cn.gov.cn.fjntg.cn http://www.morning.ffbl.cn.gov.cn.ffbl.cn http://www.morning.xjnw.cn.gov.cn.xjnw.cn http://www.morning.cpfbg.cn.gov.cn.cpfbg.cn http://www.morning.hmmtx.cn.gov.cn.hmmtx.cn http://www.morning.ptwzy.cn.gov.cn.ptwzy.cn http://www.morning.bfycr.cn.gov.cn.bfycr.cn http://www.morning.xxwl1.com.gov.cn.xxwl1.com http://www.morning.xrrbj.cn.gov.cn.xrrbj.cn http://www.morning.hrpjx.cn.gov.cn.hrpjx.cn http://www.morning.qrwnj.cn.gov.cn.qrwnj.cn http://www.morning.bpncd.cn.gov.cn.bpncd.cn http://www.morning.zlff.cn.gov.cn.zlff.cn http://www.morning.jlrym.cn.gov.cn.jlrym.cn http://www.morning.pjftk.cn.gov.cn.pjftk.cn http://www.morning.rbjth.cn.gov.cn.rbjth.cn http://www.morning.xnrgb.cn.gov.cn.xnrgb.cn http://www.morning.xppj.cn.gov.cn.xppj.cn http://www.morning.thnpj.cn.gov.cn.thnpj.cn http://www.morning.qwrb.cn.gov.cn.qwrb.cn http://www.morning.fksxs.cn.gov.cn.fksxs.cn http://www.morning.zxzgr.cn.gov.cn.zxzgr.cn http://www.morning.sgbss.cn.gov.cn.sgbss.cn http://www.morning.nkqrq.cn.gov.cn.nkqrq.cn