Spring MVC FlowchartCategory: Spring2014-02-23 19:499106 People readComments (2)CollectionReportSpring MVCSpring MVC workflow Flowchart
Figure A
Figure II
Spring Workflow Description1. The user sends the request to the server, the request is captured by the spring front-end control Servelt dispatcherservlet; 2. Dispatcherservlet parses the request URL to get the request Resource Identifier (URI). Then, according to the URI, call handlermapping to get all the related objects of the handler configuration (including the handler object and the interceptor corresponding to the handler object), and finally return as a Handlerexecutionchain object; 3. Dispatcherservlet According to the obtained handler, choose a suitable handleradapter. (
Note : If Handleradapter is successfully obtained, the Interceptor Prehandler (...) will start executing. Method ) 4. Extract the model data from the request, populate the handler entry, and start executing the handler (Controller). In the process of populating the handler, depending on your configuration, spring will do some extra work for you: httpmessageconveter: Converts a request message (such as JSON, XML, and so on) into an object, converting the object to the specified response information Data Transformation : Data conversion for a request message. such as string conversion to Integer, double, etc. data is initialized : Data is formatted for the request message. such as converting a string into a formatted number or a formatted date Data Validation : Verifying the validity of the data (length, format, etc.), and verifying that the results are stored in Bindingresult or error 5. Handler after execution, return a Modelandview object to Dispatcherservlet; 6. According to the returned Modelandview, select a suitable viewresolver (must be registered in the Spring container Viewresolver) return to Dispatcherservlet ; 7. Viewresolver combining model and view to render the view8. Return the rendering results to the client. Spring Workflow Description Why does spring use only one servlet (Dispatcherservlet) to handle all requests? Detailed view of the Java EE design mode-front-end control mode Why does spring use handlermapping and Handleradapter to deal with handler? conforms to the single-object-oriented principle of responsibility, code architecture is clear, easy to maintain, and most importantly, code reusability is high. such as handleradapter may be used to handle a variety of handler.
From for notes (Wiz)
Spring MVC Flowchart