Central dispatcher for use within the web MVC framework,
e.g. for web UI controllers or HTTP-based remote service exporters.
Dispatches to registered handlers for processing a web request.
This servlet is very flexible: It can be used with just about any workflow,
with the installation of the appropriate adapter classes. It offers the
following functionality that distinguishes it from other request-driven
web MVC frameworks:
It is based around a JavaBeans configuration mechanism.
It can use any HandlerMapping implementation - whether standard, or provided
as part of an application - to control the routing of requests to handler objects.
Default is BeanNameUrlHandlerMapping. HandlerMapping objects can be define as beans
in the servlet's application context that implement the HandlerMapping interface.
HandlerMappings can be given any bean name (they are tested by type).
It can use any HandlerAdapter; this allows to use any handler interface.
Default is SimpleControllerHandlerAdapter, for Spring's Controller interface.
Additional HandlerAdapter objects can be added through the application context.
Like HandlerMappings, HandlerAdapters can be given any bean name (tested by type).
Its exception resolution strategy can be specified via a HandlerExceptionResolver,
for example mapping certain exceptions to error pages. Default is none.
Additional HandlerExceptionResolvers can be added through the application context.
HandlerExceptionResolver can be given any bean name (tested by type).
Its view resolution strategy can be specified via a ViewResolver implementation,
resolving symbolic view names into View objects. Default is InternalResourceViewResolver.
Additional ViewResolver objects can be added through the application context.
ViewResolvers can be given any bean name (tested by type).
Its strategy for resolving multipart requests is determined by a MultipartResolver
implementation. Implementations for Jakarta Commons FileUpload and Jason Hunter's COS
are included. The MultipartResolver bean name is "multipartResolver"; default is none.
Its locale resolution strategy is determined by a LocaleResolver implementation.
Out-of-the-box implementations work via HTTP accept header, cookie, or session.
The LocaleResolver bean name is "localeResolver"; default is AcceptHeaderLocaleResolver.
Its theme resolution strategy is determined by a ThemeResolver implementation.
Implementations for a fixed theme and for cookie and session storage are included.
The ThemeResolver bean name is "themeResolver"; default is FixedThemeResolver.
A web application can use any number of DispatcherServlets. Each servlet
will operate in its own namespace. Only the root application context will be shared.
This class and the MVC approach it delivers is discussed in Chapter 12 of
Expert One-On-One J2EE Design and Development
by Rod Johnson (Wrox, 2002). Note that it is called ControllerServlet there;
it has been renamed since to emphasize its dispatching role and avoid confusion
with Controller objects that the DispatcherServlet will dispatch to.
This servlet is very flexible: It can be used with just about any workflow, with the installation of the appropriate adapter classes. It offers the following functionality that distinguishes it from other request-driven web MVC frameworks:
A web application can use any number of DispatcherServlets. Each servlet will operate in its own namespace. Only the root application context will be shared.
This class and the MVC approach it delivers is discussed in Chapter 12 of Expert One-On-One J2EE Design and Development by Rod Johnson (Wrox, 2002). Note that it is called ControllerServlet there; it has been renamed since to emphasize its dispatching role and avoid confusion with Controller objects that the DispatcherServlet will dispatch to.