Working principle and mechanism of SPRINGMVC

Source: Internet
Author: User


Working principle
Above is the schematic diagram of SPRINGMVC's work:

1, the client sends an HTTP request to the Web server, the Web server parses the HTTP request, If the request mapping path (specified in Web. xml) matches the Dispatcherservlet, the Web container will forward the request to Dispatcherservlet.

2. After receiving this request, Dipatcherservlet will find the processor (Handler) processing the request based on the requested information (including URL, HTTP method, request packet header and request parameter cookie, etc.) and handlermapping configuration.

3-4, Dispatcherservlet according to handlermapping find corresponding handler, the processing right to handler (handler will be specific processing to package), Then the specific handleradapter to the handler to make a specific call.

5, Handler will return a Modelandview () object to Dispatcherservlet after the data processing is completed.

6. Handler return Modelandview () just a logical view is not a formal view, Dispatchersevlet transforms a logical view into a real views view by Viewresolver.

7, dispatcher through the model to parse out the parameters in the Modelandview () and finally show the full view and return to the client.

What is the operation mechanism? Control Invocation (cont.)

Then for the supplement of (II): The main point is to summarize the control of the key processing logic operation;

The key to control processing is that a handler in each Handlermapping object is matched by the requested URL in the Dispatcherservlet handlermappings collection, After a successful match, the handler processing connection Handlerexecutionchain object is returned. This Handlerexecutionchain object will contain multiple user-defined Handlerinterceptor objects.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 /** * Return The Handlerexecutionchain for this request.       * <p>tries All handler mappings in order. * @param request Current HTTP request * @return The Handlerexecutionchain, or <code>null</code> if no ha Ndler could be found

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.