springmvc process tracking

 springmvc implementation process inherited from the front controller servlet method we find doService way into the dispatcherServlet in:
 this.doDispatch (Request, the Response);
which is to define some of the parameters, the main thing is:
 mv = ha.handle (processedRequest, the Response, mappedHandler .getHandler ()); a method substantially controller is called, is executed RequestMappingHandlerAdapter (implementation class is HandlerAdapter) HandlerInternal the method proceeds handleInternal:
protected ModelAndView handleInternal (the HttpServletRequest Request, Response the HttpServletResponse, HandlerMethod HandlerMethod) throws Exception {
        this.checkRequest (Request);
        ModelAndView MAV;
        IF (this.synchronizeOnSession) {
            the HttpSession = Request.getSession the session (to false);
            IF (! the session = null) {
                Object = WebUtils.getSessionMutex the mutex (the session);
                synchronized(mutex) {
                    mav = this.invokeHandlerMethod(request, response, handlerMethod);
                }
            } else {
                mav = this.invokeHandlerMethod(request, response, handlerMethod);
            }
        } else {
            mav = this.invokeHandlerMethod(request, response, handlerMethod);
        }

        if (!response.containsHeader("Cache-Control")) {
            if (this.getSessionAttributesHandler(handlerMethod).hasSessionAttributes()) {
                this.applyCacheSeconds(response, this.cacheSecondsForSessionAttributeHandlers);
            } else {
                this.prepareResponse(response);
            }
        }

        Return MAV;
    }
performed at this time is mav = this.invokeHandlerMethod (request, response, handlerMethod); wherein the method into the class is performed at this time invokeAndHandle ServletInvocableHandlerMethod class method, in fact, to invocableMethod.invokeAndHandle (webRequest, mavContainer , new Object [0]); phrase we can see the relationship which has been performed by the method
 Object returnValue = this.invokeForRequest (webRequest, mavContainer , providedArgs); invokeForRequest method is performed InvocableHandlerMethod class
Object returnValue = this.doInvoke (args); the implementation of this class doInvoke
return this.getBridgedMethod () invoke (this.getBean (), args);. it has a reflective called.

 From these we can know the track browser sends a request to come to the processor dispatcherServlet mapper RequestMappingHandlerAdapter processing control method InvocableHandlerMethod execution method adapter reflected InvocableHandlerMethod get modelandvew

Guess you like

Origin www.cnblogs.com/xyhx/p/11441712.html