A. Common class and its role
HandlerExecutionChain: Handler execution chain objects, comprising a processor request interceptor object and all the objects.
HandlerMapping: defines a mapping between all the requests of all the requesting processor.
HandlerAdaptor: Request processor adapter object, is responsible for completing the calling method request handler object and so on ...
Second running processes:
The browser sends a request to the server:
- 1.1 map corresponding to the current request does not exist in the DispatcherServlet
- ① is configured mvc: default-servlet-handler /
- If no, page 404, the console no mapping found warning.
- If there is arranged, the request to the default Tomcat Servlet processing, to find the corresponding resource
- If you have the resources, the corresponding resources returned to the browser
- If there are no resources, 404 pages.
The current request in DispatcherServlet
the corresponding map exists in
- 2.1 Object HandlerExecutionChain get through HandlerMapping (RequestMappingHandlerMapping)
- 2.2 reacquisition HandlerAdaptor (RequestMappingaHandlerAdaptor) objects
- 2.3 preHandle method performed by the interceptor objects HandlerExecutionChain
- 2.4 HandlerAdaptor executed by the processor is responsible for requesting, request processing method, the finally obtained ModelAndView object.
- 2.5 postHandle method interception performed by HandlerExecutionChain object.
- 2.6 ModelAndView object from the start parsing view resolver give view object
- 2.7 start processing by the current view object data model, and ultimately complete redirection, forwarding work
- afterCompletion method performed by the interceptor 2.8 HandlerExecutionChain object.