Spring MVC 请求和响应流程解释

Spring MVC request and response flow explanation

我在下面找不到正确的客户端请求流程syntax.Could有人请澄清这里发生了什么?

Client(1) --> Dispatcher Servlet(2) --> Handler Mapping(3) --> Controller(4) -->
ModelAndView(5) --> viewResolver(6) --> View(7) --> Client(1) 

如果可能,请说明 spring MVC 过程中使用的相应 spring classes/interfaces 是什么。

  1. DispatcherServlet 将收到请求。
  2. DispatcherServlet 将借助 HandlerMapping 并了解与给定请求关联的 @Controller class 名称。
  3. 所以请求传递给@Controller,然后@Controller将通过执行适当的方法和returns ModelAndView对象(包含模型数据和视图名称)来处理请求) 回到 DispatcherServlet
  4. 现在DispatcherServlet将模型对象发送到ViewResolver以获取实际视图页面。
  5. 最后,DispatcherServlet将Model对象传递给View页面显示结果。

Spring Flow First Request from JSP/HTML will hit the dispacher servlet, Based on the xml file it will go to particular controller, After going to controller it search for request mapping , based on request mapping it will go to the particular method and follows instructions and takes the model and view and give it to view resolver via dispacher servlet and view resolver will display the view.

我补充上面的解释。请求流程如下。

Client --> WAS(通过过滤器)--> DispatcherServlet.doService, doDispatch --> Dispatcher Servlet.handlerMapping,hanlderAdapter --> Controller return ModelAndView --> DispatcherServlet.processDispatchResult, render, resolveViewName --> View --> Client.

我认为用断点调试 DispatcherServlet 的方法是理解请求流的好方法。