|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.springframework.web.servlet.HttpServletBean org.springframework.web.servlet.FrameworkServlet org.springframework.web.servlet.DispatcherServlet
Concrete front controller for use within the web MVC framework. Dispatches to registered handlers for processing a web request.
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).
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 MVC frameworks:
A web application can use any number of dispatcher servlets. Each servlet will operate in its own namespace. Only the root application context, and any config objects set for the application as a whole, will be shared.
HandlerMapping
,
HandlerAdapter
,
ViewResolver
,
MultipartResolver
,
LocaleResolver
,
ThemeResolver
,
WebApplicationContext
,
ContextLoaderListener
,
Serialized FormField Summary | |
static java.lang.String |
EXCEPTION_RESOLVER_BEAN_NAME
Well-known name for the ExceptionResolver object in the bean factory for this namespace. |
static java.lang.String |
LOCALE_RESOLVER_ATTRIBUTE
Request attribute to hold current locale, retrievable by views. |
static java.lang.String |
LOCALE_RESOLVER_BEAN_NAME
Well-known name for the LocaleResolver object in the bean factory for this namespace. |
static java.lang.String |
MULTIPART_RESOLVER_ATTRIBUTE
Request attribute to hold current multipart resolver, retrievable by views/binders. |
static java.lang.String |
MULTIPART_RESOLVER_BEAN_NAME
Well-known name for the MultipartResolver object in the bean factory for this namespace. |
protected org.apache.commons.logging.Log |
pageNotFoundLogger
Additional logger for use when no mapping handlers are found for a request. |
static java.lang.String |
THEME_RESOLVER_ATTRIBUTE
Request attribute to hold current theme, retrievable by views. |
static java.lang.String |
THEME_RESOLVER_BEAN_NAME
Well-known name for the ThemeResolver object in the bean factory for this namespace. |
static java.lang.String |
VIEW_RESOLVER_BEAN_NAME
Well-known name for the ViewResolver object in the bean factory for this namespace. |
static java.lang.String |
WEB_APPLICATION_CONTEXT_ATTRIBUTE
Request attribute to hold current web application context. |
Fields inherited from class org.springframework.web.servlet.FrameworkServlet |
DEFAULT_CONTEXT_CLASS, DEFAULT_NAMESPACE_SUFFIX, SERVLET_CONTEXT_PREFIX |
Fields inherited from class org.springframework.web.servlet.HttpServletBean |
logger |
Constructor Summary | |
DispatcherServlet()
|
Method Summary | |
protected void |
doService(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Obtain and use the handler for this method. |
protected long |
getLastModified(javax.servlet.http.HttpServletRequest request)
Override HttpServlet's getLastModified to evaluate the Last-Modified value of the mapped handler. |
protected void |
initFrameworkServlet()
Overridden method, invoked after any bean properties have been set and the WebApplicationContext and BeanFactory for this namespace is available. |
Methods inherited from class org.springframework.web.servlet.FrameworkServlet |
createWebApplicationContext, destroy, doGet, doPost, getContextClass, getContextConfigLocation, getNamespace, getServletContextAttributeName, getWebApplicationContext, initServletBean, initWebApplicationContext, isPublishContext, setContextClass, setContextConfigLocation, setNamespace, setPublishContext |
Methods inherited from class org.springframework.web.servlet.HttpServletBean |
init, setRequiredProperty |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, service, service |
Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String MULTIPART_RESOLVER_BEAN_NAME
public static final java.lang.String LOCALE_RESOLVER_BEAN_NAME
public static final java.lang.String THEME_RESOLVER_BEAN_NAME
public static final java.lang.String EXCEPTION_RESOLVER_BEAN_NAME
public static final java.lang.String VIEW_RESOLVER_BEAN_NAME
public static final java.lang.String WEB_APPLICATION_CONTEXT_ATTRIBUTE
public static final java.lang.String LOCALE_RESOLVER_ATTRIBUTE
RequestContext
public static final java.lang.String MULTIPART_RESOLVER_ATTRIBUTE
RequestContextUtils
public static final java.lang.String THEME_RESOLVER_ATTRIBUTE
RequestContext
protected final org.apache.commons.logging.Log pageNotFoundLogger
Constructor Detail |
public DispatcherServlet()
Method Detail |
protected void initFrameworkServlet() throws javax.servlet.ServletException, BeansException
Loads HandlerMapping and HandlerAdapter objects, and configures a ViewResolver and a LocaleResolver.
initFrameworkServlet
in class FrameworkServlet
javax.servlet.ServletException
- in case of an initialization exception
BeansException
- if thrown by ApplicationContext methodsprotected void doService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception
doService
in class FrameworkServlet
java.lang.Exception
- in case of any kind of processing failureHttpServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
,
HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
protected long getLastModified(javax.servlet.http.HttpServletRequest request)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |