SpringMVC request response process

picture

Nine components of SpringMVC

  1. MultipartResolver: Components that resolve file uploads
  2. LocaleResolver: Internationalization Locale parsing component
  3. ThemeResolver: theme skin analysis
  4. HandlerMapping: Process the mapper, urlfind the background processor according to the address
  5. HandlerAdapters: processor adapter (the most complex component)
  6. HandlerExceptionResolver: exception parser for the handler
  7. RequestToViewNameTranslator: When there is no view return value, resolve the view name according to the request
  8. ViewResolver: The view resolver, according to the name of the logical view, combines the data and returns it into a view
  9. FlashMapManager: Redirected pass-value component

SpringMVC request response process

  1. Call its doDispatchmethod to process the web request.
  2. According to MultipartResolverthe component, determine whether this request is a file upload request.
  3. According to HandlerMappingthe component and the path of the request, find the corresponding processor call chain.
  4. Get components according to the corresponding processor type HanderAdapter.
  5. Call applyPreHandlethe method for pre-interception processing.
  6. By HanderAdaptercalling the processor method, and uniformly return ModelAndiewthe object.
  7. ModelAndiewIf there is no view information in the returned object, call RequestToViewNamethe component to parse out a brand new view name.
  8. Call applyPostHandlethe method for post-interception processing.
  9. Run result processing
    1. If an exception has been caught before, perform exception handling. Call the processor exception parser component, parse out ModelAndView, and continue to step 9.2
    2. Do page rendering
      1. LocaleResolverGet regional language information with .
      2. With the help of the view resolver component, according to the name of the logical view, resolve View(view name).
      3. viewThe called rendermethod renders the page and Modelconverts or redirects according to the data.
  10. Call triggerAfterCompletionthe interceptor method.
    Note: If an exception is thrown between 2-8, the exception information will be recorded.

Guess you like

Origin blog.csdn.net/ainklg/article/details/113899512