SpringMVC调用流程
2024-03-25 21:23:57   20  举报             
     
         
 SpringMVC调用流程
    作者其他创作
 大纲/内容
 不是
  页面异常处理
  渲染视图
  AbstractHandlerMethodMapping#getHandlerInternal获取执行HandlerMethod
  如果是上传文件类型,则删除临时文件
  是
  转换为MultipartHttpServletRequest
  根据Handler 选择HandlerAdpater
  调用所有HandlerMapping#getHandler有返回则使用
  处理返回值HandlerMethodReturnValueHandler#handleReturnValue
  MappedInterceptor需要匹配才会加入调用链,其他都胡加入
  通过适配器调用真正的方法
  当前有返回false是会反向调用所有已经调用过的拦截器HandlerInterceptor#afterCompletion
  AbstractHandlerMapping#getHandlerExecutionChain添加拦截器
  ServletInvocableHandlerMethod#invokeAndHandle真正调用
  获取HandlerExecuteChain
  HandlerExecutionChain#applyPreHandle
  http请求
  是否是文件上传
  依次调用直到调用完或者有返回false
  调用拦截器HandlerInterceptor#afterCompletion
  doDispatch
  DispatcherServlet#getHandlerAdapter遍历调用HandlerAdapter#supports
  RequestResponseBodyMethodProcessor处理@RequestBody
  RequestMappingHandlerAdapter#invokeHandlerMethod
  调用拦截器HandlerInterceptor#postHandle
  DispatcherServlet#doService
  触发拦截器HandlerInterceptor#preHandle
   
 
 
 
 
  0 条评论
 下一页
  
   
   
   
   
  
  
  
  
  
  
  
  
 