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 是什么。
DispatcherServlet
将收到请求。
DispatcherServlet
将借助 HandlerMapping
并了解与给定请求关联的 @Controller
class 名称。
- 所以请求传递给
@Controller
,然后@Controller
将通过执行适当的方法和returns ModelAndView
对象(包含模型数据和视图名称)来处理请求) 回到 DispatcherServlet
- 现在
DispatcherServlet
将模型对象发送到ViewResolver
以获取实际视图页面。
- 最后,
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 的方法是理解请求流的好方法。
我在下面找不到正确的客户端请求流程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 是什么。
DispatcherServlet
将收到请求。DispatcherServlet
将借助HandlerMapping
并了解与给定请求关联的@Controller
class 名称。- 所以请求传递给
@Controller
,然后@Controller
将通过执行适当的方法和returnsModelAndView
对象(包含模型数据和视图名称)来处理请求) 回到 DispatcherServlet - 现在
DispatcherServlet
将模型对象发送到ViewResolver
以获取实际视图页面。 - 最后,
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 的方法是理解请求流的好方法。