SringMVC notes

SpringMvc three main Servlet: HttpServletBean, FramwworkServlet, DispatcherServlet, which are sequentially inheritance relationship, its processing functions substantially as follows:

1.HttpServletBean: did not participate in the actual processing of the request.

2.FramwworkServlet: the different requests merged into a unified processing method processRequest, processRequest method does three things.

  a. DETAILED call processing request template doService

  b. Place LocalContext ServletRequestAttributes current request and provided at the front and a processing request to LocalContextHolder RequestContextHolder, and respond to the request processing is complete.

  C. ServletRequstHandleEvent request processing completion message issued.

3.DispatcherServlet: doService method is provided to request and forwards the request to a number of properties doDispatch specific processing method.

 

SpringMvc nine components:

1.HandlerMappping: its role is to find the corresponding processor in accordance with Handler, and Interceptors request, there is only one interface method:

   HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception;

 

2.HandlerAdapter: Handler adapter. HandlerApdater processor adapter, is to call the method to find the processor url request.

   Because SpringMvc Handler may be in any form, as long as the processing request. However, the structure of the processing method of the Servlet needs indeed fixed, it is based on the request and response parameters for the method, so it is necessary to adapt the HandlerApdater.

 

Guess you like

Origin www.cnblogs.com/xuzimian/p/10965917.html