JSF-Spring

de.mindmatters.faces.spring.context.servlet
Class FacesDispatcherServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.springframework.web.servlet.HttpServletBean
              extended by org.springframework.web.servlet.FrameworkServlet
                  extended by org.springframework.web.servlet.DispatcherServlet
                      extended by de.mindmatters.faces.spring.context.servlet.FacesDispatcherServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class FacesDispatcherServlet
extends DispatcherServlet

Central dispatcher which integrates Spring's MVC framework to the faces lifecycle. For further information please have a look at the Spring docs.

Author:
Andreas Kuhrwahl
See Also:
Serialized Form

Nested Class Summary
static class FacesDispatcherServlet.DefaultApplicationContext
          Default ApplicationContext for the FacesDispatcherServlet.
 
Field Summary
 
Fields inherited from class org.springframework.web.servlet.DispatcherServlet
HANDLER_ADAPTER_BEAN_NAME, HANDLER_EXCEPTION_RESOLVER_BEAN_NAME, HANDLER_EXECUTION_CHAIN_ATTRIBUTE, HANDLER_MAPPING_BEAN_NAME, LOCALE_RESOLVER_ATTRIBUTE, LOCALE_RESOLVER_BEAN_NAME, MULTIPART_RESOLVER_BEAN_NAME, PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger, REQUEST_TO_VIEW_NAME_TRANSLATOR_BEAN_NAME, THEME_RESOLVER_ATTRIBUTE, THEME_RESOLVER_BEAN_NAME, THEME_SOURCE_ATTRIBUTE, VIEW_RESOLVER_BEAN_NAME, WEB_APPLICATION_CONTEXT_ATTRIBUTE
 
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
FacesDispatcherServlet()
          Standard Constructor.
 
Method Summary
protected  HandlerAdapter getHandlerAdapter(java.lang.Object handler)
          Return the HandlerAdapter for this handler object.
protected  void initDispatcherServlet()
          This method will be invoked after any bean properties have been set and the WebApplicationContext has been loaded.
protected  void initFrameworkServlet()
          Overridden method, invoked after any bean properties have been set and the WebApplicationContext and BeanFactory for this namespace is available.
protected  WebApplicationContext initWebApplicationContext()
          Initialize and publish the WebApplicationContext for this servlet.
protected  ModelAndView processHandlerException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, java.lang.Exception ex)
          Determine an error ModelAndView via the registered HandlerExceptionResolvers.
 void service(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
          
 
Methods inherited from class org.springframework.web.servlet.DispatcherServlet
checkMultipart, createDefaultStrategy, doDispatch, doService, getDefaultStrategies, getDefaultStrategy, getDefaultViewName, getHandler, getLastModified, getThemeSource, noHandlerFound, render, resolveViewName, setCleanupAfterInclude, setDetectAllHandlerAdapters, setDetectAllHandlerExceptionResolvers, setDetectAllHandlerMappings, setDetectAllViewResolvers
 
Methods inherited from class org.springframework.web.servlet.FrameworkServlet
createWebApplicationContext, destroy, doDelete, doGet, doPost, doPut, getContextClass, getContextConfigLocation, getNamespace, getServletContextAttributeName, getUsernameForRequest, getWebApplicationContext, initServletBean, isPublishContext, isPublishEvents, processRequest, setContextClass, setContextConfigLocation, setNamespace, setPublishContext, setPublishEvents
 
Methods inherited from class org.springframework.web.servlet.HttpServletBean
addRequiredProperty, getServletContext, getServletName, init, initBeanWrapper
 
Methods inherited from class javax.servlet.http.HttpServlet
doHead, doOptions, doTrace, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletInfo, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacesDispatcherServlet

public FacesDispatcherServlet()
Standard Constructor.

Method Detail

initWebApplicationContext

protected WebApplicationContext initWebApplicationContext()
Initialize and publish the WebApplicationContext for this servlet. Delegates to createWebApplicationContext for actual creation. Can be overridden in subclasses.

Overrides:
initWebApplicationContext in class FrameworkServlet
See Also:
FrameworkServlet.createWebApplicationContext(org.springframework.web.context.WebApplicationContext)

service

public final void service(javax.servlet.ServletRequest request,
                          javax.servlet.ServletResponse response)
                   throws javax.servlet.ServletException,
                          java.io.IOException

Specified by:
service in interface javax.servlet.Servlet
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

initFrameworkServlet

protected final void initFrameworkServlet()
                                   throws javax.servlet.ServletException
Overridden method, invoked after any bean properties have been set and the WebApplicationContext and BeanFactory for this namespace is available.

Loads HandlerMapping and HandlerAdapter objects, and configures a ViewResolver and a LocaleResolver.

Overrides:
initFrameworkServlet in class DispatcherServlet
Throws:
javax.servlet.ServletException - in case of an initialization exception

initDispatcherServlet

protected void initDispatcherServlet()
                              throws javax.servlet.ServletException
This method will be invoked after any bean properties have been set and the WebApplicationContext has been loaded. The default implementation is empty; subclasses may override this method to perform any initialization they require.

Throws:
javax.servlet.ServletException - in case of an initialization exception
BeansException - if thrown by ApplicationContext methods

getHandlerAdapter

protected final HandlerAdapter getHandlerAdapter(java.lang.Object handler)
                                          throws javax.servlet.ServletException
Return the HandlerAdapter for this handler object.

Overrides:
getHandlerAdapter in class DispatcherServlet
Parameters:
handler - the handler object to find an adapter for
Throws:
javax.servlet.ServletException - if no HandlerAdapter can be found for the handler. This is a fatal error.

processHandlerException

protected final ModelAndView processHandlerException(javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response,
                                                     java.lang.Object handler,
                                                     java.lang.Exception ex)
                                              throws java.lang.Exception
Determine an error ModelAndView via the registered HandlerExceptionResolvers.

Overrides:
processHandlerException in class DispatcherServlet
Parameters:
request - current HTTP request
response - current HTTP response
handler - the executed handler, or null if none chosen at the time of the exception (for example, if multipart resolution failed)
ex - the exception that got thrown during handler execution
Returns:
a corresponding ModelAndView to forward to
Throws:
java.lang.Exception - if no error ModelAndView found

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG