Index
Official website of Spring MVC says the following
Spring’s web MVC framework is, like many other web MVC frameworks, request-driven, designed around a central Servlet that dispatches requests to controllers and offers other functionality that facilitates the development of web applications. Spring’s DispatcherServlet however, does more than just that. It is completely integrated with the Spring IoC container and as such allows you to use every other feature that Spring has.
The processing flow of Spring MVC from receiving the request till the response is returned is shown in the following diagram.
Among the components explained previously, the extendable components are implemented.
Class hierarchy of HandlerMapping provided by Spring framework is shown below.
Usually org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping is used. This class reads @RequestMapping annotation from the Controller and uses the method of Controller that matches with URL as Handler class.
In Spring3.1, RequestMappingHandlerMapping is enabled by default when <mvc:annotation-driven> is set in Bean definition file read by DispatcherServlet. (For the settings which get enabled with the use of <mvc:annotation-driven> annotation, refer Web MVC framework.)
Class hierarchy of HandlerAdapter provided by Spring framework is shown below.
Usually org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter is used. RequestMappingHandlerAdapter class calls the method of handler class (Controller) selected by HandlerMapping. In Spring 3.1, this class is also configured by default throught <mvc:annotation-driven>.
Classes that implement ViewResolver provided by Spring framework and dependent libraries are shown below.
Normally (When JSP is used),
however, when template engine Tiles is to be used
and when stream is to be returned for file download
Thereby, it is required to use different viewResolver based on the type of the View that needs to be returned.
Classes that implement View provided by Spring framework and its dependent libraries are shown below.
View changes with the type of response to be returned. When JSP is to be returned, org.springframework.web.servlet.view.JstlView is used. When View not provided by Spring framework and its dependent libraries are to be handled, it is necessary to extend the class in which View interface is implemented. For details, refer [coming soon] File Download.