|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.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 will be shared.
HandlerMapping
,
HandlerAdapter
,
ViewResolver
,
MultipartResolver
,
LocaleResolver
,
ThemeResolver
,
WebApplicationContext
,
ContextLoaderListener
,
Serialized FormField Summary | |
static java.lang.String |
HANDLER_EXCEPTION_RESOLVER_BEAN_NAME
Well-known name for the HandlerExceptionResolver object in the bean factory for this namespace. |
static java.lang.String |
HANDLER_MAPPING_BEAN_NAME
Well-known name for the HandlerMapping 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. |
static java.lang.String |
PAGE_NOT_FOUND_LOG_CATEGORY
Log category to use when no mapped handler is found for a request. |
protected static org.apache.commons.logging.Log |
pageNotFoundLogger
Additional logger to use when no mapped handler is 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. |
void |
setDetectAllHandlerExceptionResolvers(boolean detectAllHandlerExceptionResolvers)
Set whether to detect all HandlerExceptionResolver beans in this servlet's context. |
void |
setDetectAllHandlerMappings(boolean detectAllHandlerMappings)
Set whether to detect all HandlerMapping beans in this servlet's context. |
void |
setDetectAllViewResolvers(boolean detectAllViewResolvers)
Set whether to detect all ViewResolver beans in this servlet's context. |
Methods inherited from class org.springframework.web.servlet.FrameworkServlet |
createWebApplicationContext, destroy, getContextClass, getContextConfigLocation, getNamespace, getServletContextAttributeName, getUsernameForRequest, getWebApplicationContext, initServletBean, initWebApplicationContext, isPublishContext, service, setContextClass, setContextConfigLocation, setNamespace, setPublishContext |
Methods inherited from class org.springframework.web.servlet.HttpServletBean |
addRequiredProperty, init, initBeanWrapper |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, 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 HANDLER_MAPPING_BEAN_NAME
setDetectAllViewResolvers(boolean)
,
Constant Field Valuespublic static final java.lang.String HANDLER_EXCEPTION_RESOLVER_BEAN_NAME
setDetectAllViewResolvers(boolean)
,
Constant Field Valuespublic static final java.lang.String VIEW_RESOLVER_BEAN_NAME
setDetectAllViewResolvers(boolean)
,
Constant Field Valuespublic static final java.lang.String WEB_APPLICATION_CONTEXT_ATTRIBUTE
public static final java.lang.String MULTIPART_RESOLVER_ATTRIBUTE
RequestContextUtils
public static final java.lang.String LOCALE_RESOLVER_ATTRIBUTE
RequestContext
public static final java.lang.String THEME_RESOLVER_ATTRIBUTE
RequestContext
public static final java.lang.String PAGE_NOT_FOUND_LOG_CATEGORY
protected static final org.apache.commons.logging.Log pageNotFoundLogger
Constructor Detail |
public DispatcherServlet()
Method Detail |
public void setDetectAllHandlerMappings(boolean detectAllHandlerMappings)
Default is true. Turn this off if you want this servlet to use a single HandlerMapping, despite multiple HandlerMapping beans being defined in the context.
public void setDetectAllHandlerExceptionResolvers(boolean detectAllHandlerExceptionResolvers)
Default is true. Turn this off if you want this servlet to use a single HandlerExceptionResolver, despite multiple HandlerExceptionResolver beans being defined in the context.
public void setDetectAllViewResolvers(boolean detectAllViewResolvers)
Default is true. Turn this off if you want this servlet to use a single ViewResolver, despite multiple ViewResolver beans being defined in the context.
protected void initFrameworkServlet() throws javax.servlet.ServletException, BeansException
Loads HandlerMapping and HandlerAdapter objects, and configures a ViewResolver and a LocaleResolver.
initFrameworkServlet
in class FrameworkServlet
BeansException
- if thrown by ApplicationContext methods
javax.servlet.ServletException
- in case of an initialization exceptionprotected 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 |