org.springframework.web.portlet
Class DispatcherPortlet

java.lang.Object
  extended by GenericPortlet
      extended by org.springframework.web.portlet.GenericPortletBean
          extended by org.springframework.web.portlet.FrameworkPortlet
              extended by org.springframework.web.portlet.DispatcherPortlet
All Implemented Interfaces:
java.util.EventListener, Aware, ApplicationListener<ContextRefreshedEvent>, EnvironmentAware

public class DispatcherPortlet
extends FrameworkPortlet

Central dispatcher for use within the Portlet MVC framework, e.g. for web UI controllers. Dispatches to registered handlers for processing a portlet request.

This portlet 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 portlet MVC frameworks:

NOTE: The @RequestMapping annotation will only be processed if a corresponding HandlerMapping (for type level annotations) and/or HandlerAdapter (for method level annotations) is present in the dispatcher. This is the case by default. However, if you are defining custom HandlerMappings or HandlerAdapters, then you need to make sure that a corresponding custom DefaultAnnotationHandlerMapping and/or AnnotationMethodHandlerAdapter is defined as well - provided that you intend to use @RequestMapping.

A web application can define any number of DispatcherPortlets. Each portlet will operate in its own namespace, loading its own application context with mappings, handlers, etc. Only the root application context as loaded by ContextLoaderListener, if any, will be shared.

Thanks to Rainer Schmitz and Nick Lothian for their suggestions!

Since:
2.0
Author:
William G. Thompson, Jr., John A. Lewis, Juergen Hoeller
See Also:
Controller, ViewRendererServlet, ContextLoaderListener

Field Summary
static java.lang.String ACTION_EXCEPTION_RENDER_PARAMETER
          This render parameter is used to indicate forward to the render phase that an exception occurred during the action phase.
static java.lang.String ACTION_EXCEPTION_SESSION_ATTRIBUTE
          Unlike the Servlet version of this class, we have to deal with the two-phase nature of the portlet request.
private static java.lang.String DEFAULT_STRATEGIES_PATH
          Name of the class path resource (relative to the DispatcherPortlet class) that defines DispatcherPortet's default strategy names.
static java.lang.String DEFAULT_VIEW_RENDERER_URL
          Default URL to ViewRendererServlet.
private static java.util.Properties defaultStrategies
           
private  boolean detectAllHandlerAdapters
          Detect all HandlerAdapters or just expect "handlerAdapter" bean?
private  boolean detectAllHandlerExceptionResolvers
          Detect all HandlerExceptionResolvers or just expect "handlerExceptionResolver" bean?
private  boolean detectAllHandlerMappings
          Detect all HandlerMappings or just expect "handlerMapping" bean?
private  boolean detectAllViewResolvers
          Detect all ViewResolvers or just expect "viewResolver" bean?
static java.lang.String HANDLER_ADAPTER_BEAN_NAME
          Well-known name for the HandlerAdapter object in the bean factory for this namespace.
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.
private  java.util.List<HandlerAdapter> handlerAdapters
          List of HandlerAdapters used by this portlet
private  java.util.List<HandlerExceptionResolver> handlerExceptionResolvers
          List of HandlerExceptionResolvers used by this portlet
private  java.util.List<HandlerMapping> handlerMappings
          List of HandlerMappings used by this portlet
static java.lang.String MULTIPART_RESOLVER_BEAN_NAME
          Well-known name for the PortletMultipartResolver object in the bean factory for this namespace.
private  PortletMultipartResolver multipartResolver
          MultipartResolver used by this portlet
static java.lang.String PAGE_NOT_FOUND_LOG_CATEGORY
          Log category to use when no mapped handler is found for a request.
protected static Log pageNotFoundLogger
          Additional logger to use when no mapped handler is found for a request.
static java.lang.String VIEW_RESOLVER_BEAN_NAME
          Well-known name for the ViewResolver object in the bean factory for this namespace.
private  java.lang.String viewRendererUrl
          URL that points to the ViewRendererServlet
private  java.util.List<ViewResolver> viewResolvers
          List of ViewResolvers used by this portlet
 
Fields inherited from class org.springframework.web.portlet.FrameworkPortlet
DEFAULT_CONTEXT_CLASS, DEFAULT_NAMESPACE_SUFFIX, DEFAULT_USERINFO_ATTRIBUTE_NAMES, PORTLET_CONTEXT_PREFIX
 
Fields inherited from class org.springframework.web.portlet.GenericPortletBean
logger
 
Constructor Summary
DispatcherPortlet()
           
 
Method Summary
protected  ActionRequest checkMultipart(ActionRequest request)
          Convert the request into a multipart request, and make multipart resolver available.
protected  java.lang.Object createDefaultStrategy(ApplicationContext context, java.lang.Class<?> clazz)
          Create a default strategy.
protected  void doActionService(ActionRequest request, ActionResponse response)
          Processes the actual dispatching to the handler for action requests.
protected  void doEventService(EventRequest request, EventResponse response)
          Processes the actual dispatching to the handler for event requests.
protected  void doRender(View view, java.util.Map model, PortletRequest request, MimeResponse response)
          Actually render the given view.
protected  void doRenderService(RenderRequest request, RenderResponse response)
          Processes the actual dispatching to the handler for render requests.
protected  void doResourceService(ResourceRequest request, ResourceResponse response)
          Processes the actual dispatching to the handler for resource requests.
protected  void exposeActionException(PortletRequest request, StateAwareResponse response, java.lang.Exception ex)
          Expose the given action exception to the given response.
protected
<T> java.util.List<T>
getDefaultStrategies(ApplicationContext context, java.lang.Class<T> strategyInterface)
          Create a List of default strategy objects for the given strategy interface.
protected
<T> T
getDefaultStrategy(ApplicationContext context, java.lang.Class<T> strategyInterface)
          Return the default strategy object for the given strategy interface.
protected  HandlerExecutionChain getHandler(PortletRequest request)
          Return the HandlerExecutionChain for this request.
protected  HandlerAdapter getHandlerAdapter(java.lang.Object handler)
          Return the HandlerAdapter for this handler object.
 PortletMultipartResolver getMultipartResolver()
          Obtain this portlet's PortletMultipartResolver, if any.
private  void initHandlerAdapters(ApplicationContext context)
          Initialize the HandlerAdapters used by this class.
private  void initHandlerExceptionResolvers(ApplicationContext context)
          Initialize the HandlerExceptionResolver used by this class.
private  void initHandlerMappings(ApplicationContext context)
          Initialize the HandlerMappings used by this class.
private  void initMultipartResolver(ApplicationContext context)
          Initialize the PortletMultipartResolver used by this class.
protected  void initStrategies(ApplicationContext context)
          Refresh the strategy objects that this portlet uses.
private  void initViewResolvers(ApplicationContext context)
          Initialize the ViewResolvers used by this class.
protected  void noHandlerFound(PortletRequest request, PortletResponse response)
          No handler found -> throw appropriate exception.
 void onRefresh(ApplicationContext context)
          This implementation calls initStrategies(org.springframework.context.ApplicationContext).
protected  ModelAndView processHandlerException(RenderRequest request, RenderResponse response, java.lang.Object handler, java.lang.Exception ex)
          Determine an error ModelAndView via the registered HandlerExceptionResolvers.
protected  ModelAndView processHandlerException(ResourceRequest request, ResourceResponse response, java.lang.Object handler, java.lang.Exception ex)
          Determine an error ModelAndView via the registered HandlerExceptionResolvers.
protected  void render(ModelAndView mv, PortletRequest request, MimeResponse response)
          Render the given ModelAndView.
protected  View resolveViewName(java.lang.String viewName, java.util.Map model, PortletRequest request)
          Resolve the given view name into a View object (to be rendered).
 void setDetectAllHandlerAdapters(boolean detectAllHandlerAdapters)
          Set whether to detect all HandlerAdapter beans in this portlet's context.
 void setDetectAllHandlerExceptionResolvers(boolean detectAllHandlerExceptionResolvers)
          Set whether to detect all HandlerExceptionResolver beans in this portlet's context.
 void setDetectAllHandlerMappings(boolean detectAllHandlerMappings)
          Set whether to detect all HandlerMapping beans in this portlet's context.
 void setDetectAllViewResolvers(boolean detectAllViewResolvers)
          Set whether to detect all ViewResolver beans in this portlet's context.
 void setViewRendererUrl(java.lang.String viewRendererUrl)
          Set the URL to the ViewRendererServlet.
private  void triggerAfterActionCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex, ActionRequest request, ActionResponse response, java.lang.Exception ex)
          Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
private  void triggerAfterEventCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex, EventRequest request, EventResponse response, java.lang.Exception ex)
          Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
private  void triggerAfterRenderCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex, RenderRequest request, RenderResponse response, java.lang.Exception ex)
          Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
private  void triggerAfterResourceCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex, ResourceRequest request, ResourceResponse response, java.lang.Exception ex)
          Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
 
Methods inherited from class org.springframework.web.portlet.FrameworkPortlet
buildLocaleContext, createPortletApplicationContext, destroy, doDispatch, getContextClass, getContextConfigLocation, getNamespace, getPortletApplicationContext, getPortletContextAttributeName, getTitle, getUsernameForRequest, initFrameworkPortlet, initPortletApplicationContext, initPortletBean, onApplicationEvent, postProcessPortletApplicationContext, processAction, processEvent, processRequest, refresh, serveResource, setContextClass, setContextConfigLocation, setNamespace, setPublishContext, setPublishEvents, setThreadContextInheritable, setUserinfoUsernameAttributes
 
Methods inherited from class org.springframework.web.portlet.GenericPortletBean
addRequiredProperty, getPortletContext, getPortletName, init, initBeanWrapper, setEnvironment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.context.ApplicationListener
onApplicationEvent
 

Field Detail

MULTIPART_RESOLVER_BEAN_NAME

public static final java.lang.String MULTIPART_RESOLVER_BEAN_NAME
Well-known name for the PortletMultipartResolver object in the bean factory for this namespace.

See Also:
Constant Field Values

HANDLER_MAPPING_BEAN_NAME

public static final java.lang.String HANDLER_MAPPING_BEAN_NAME
Well-known name for the HandlerMapping object in the bean factory for this namespace. Only used when "detectAllHandlerMappings" is turned off.

See Also:
setDetectAllViewResolvers(boolean), Constant Field Values

HANDLER_ADAPTER_BEAN_NAME

public static final java.lang.String HANDLER_ADAPTER_BEAN_NAME
Well-known name for the HandlerAdapter object in the bean factory for this namespace. Only used when "detectAllHandlerAdapters" is turned off.

See Also:
setDetectAllHandlerAdapters(boolean), Constant Field Values

HANDLER_EXCEPTION_RESOLVER_BEAN_NAME

public static final java.lang.String HANDLER_EXCEPTION_RESOLVER_BEAN_NAME
Well-known name for the HandlerExceptionResolver object in the bean factory for this namespace. Only used when "detectAllHandlerExceptionResolvers" is turned off.

See Also:
setDetectAllViewResolvers(boolean), Constant Field Values

VIEW_RESOLVER_BEAN_NAME

public static final java.lang.String VIEW_RESOLVER_BEAN_NAME
Well-known name for the ViewResolver object in the bean factory for this namespace.

See Also:
Constant Field Values

DEFAULT_VIEW_RENDERER_URL

public static final java.lang.String DEFAULT_VIEW_RENDERER_URL
Default URL to ViewRendererServlet. This bridge servlet is used to convert portlet render requests to servlet requests in order to leverage the view support in the org.springframework.web.view package.

See Also:
Constant Field Values

ACTION_EXCEPTION_SESSION_ATTRIBUTE

public static final java.lang.String ACTION_EXCEPTION_SESSION_ATTRIBUTE
Unlike the Servlet version of this class, we have to deal with the two-phase nature of the portlet request. To do this, we need to pass forward any exception that occurs during the action phase, so that it can be displayed in the render phase. The only direct way to pass things forward and preserve them for each render request is through render parameters, but these are limited to String objects and we need to pass the Exception itself. The only other way to do this is in the session. The bad thing about using the session is that we have no way of knowing when we are done re-rendering the request and so we don't know when we can remove the objects from the session. So we will end up polluting the session with an old exception when we finally leave the render phase of one request and move on to something else.


ACTION_EXCEPTION_RENDER_PARAMETER

public static final java.lang.String ACTION_EXCEPTION_RENDER_PARAMETER
This render parameter is used to indicate forward to the render phase that an exception occurred during the action phase.

See Also:
Constant Field Values

PAGE_NOT_FOUND_LOG_CATEGORY

public static final java.lang.String PAGE_NOT_FOUND_LOG_CATEGORY
Log category to use when no mapped handler is found for a request.

See Also:
Constant Field Values

DEFAULT_STRATEGIES_PATH

private static final java.lang.String DEFAULT_STRATEGIES_PATH
Name of the class path resource (relative to the DispatcherPortlet class) that defines DispatcherPortet's default strategy names.

See Also:
Constant Field Values

pageNotFoundLogger

protected static final Log pageNotFoundLogger
Additional logger to use when no mapped handler is found for a request.


defaultStrategies

private static final java.util.Properties defaultStrategies

detectAllHandlerMappings

private boolean detectAllHandlerMappings
Detect all HandlerMappings or just expect "handlerMapping" bean?


detectAllHandlerAdapters

private boolean detectAllHandlerAdapters
Detect all HandlerAdapters or just expect "handlerAdapter" bean?


detectAllHandlerExceptionResolvers

private boolean detectAllHandlerExceptionResolvers
Detect all HandlerExceptionResolvers or just expect "handlerExceptionResolver" bean?


detectAllViewResolvers

private boolean detectAllViewResolvers
Detect all ViewResolvers or just expect "viewResolver" bean?


viewRendererUrl

private java.lang.String viewRendererUrl
URL that points to the ViewRendererServlet


multipartResolver

private PortletMultipartResolver multipartResolver
MultipartResolver used by this portlet


handlerMappings

private java.util.List<HandlerMapping> handlerMappings
List of HandlerMappings used by this portlet


handlerAdapters

private java.util.List<HandlerAdapter> handlerAdapters
List of HandlerAdapters used by this portlet


handlerExceptionResolvers

private java.util.List<HandlerExceptionResolver> handlerExceptionResolvers
List of HandlerExceptionResolvers used by this portlet


viewResolvers

private java.util.List<ViewResolver> viewResolvers
List of ViewResolvers used by this portlet

Constructor Detail

DispatcherPortlet

public DispatcherPortlet()
Method Detail

setDetectAllHandlerMappings

public void setDetectAllHandlerMappings(boolean detectAllHandlerMappings)
Set whether to detect all HandlerMapping beans in this portlet's context. Else, just a single bean with name "handlerMapping" will be expected.

Default is true. Turn this off if you want this portlet to use a single HandlerMapping, despite multiple HandlerMapping beans being defined in the context.


setDetectAllHandlerAdapters

public void setDetectAllHandlerAdapters(boolean detectAllHandlerAdapters)
Set whether to detect all HandlerAdapter beans in this portlet's context. Else, just a single bean with name "handlerAdapter" will be expected.

Default is "true". Turn this off if you want this portlet to use a single HandlerAdapter, despite multiple HandlerAdapter beans being defined in the context.


setDetectAllHandlerExceptionResolvers

public void setDetectAllHandlerExceptionResolvers(boolean detectAllHandlerExceptionResolvers)
Set whether to detect all HandlerExceptionResolver beans in this portlet's context. Else, just a single bean with name "handlerExceptionResolver" will be expected.

Default is true. Turn this off if you want this portlet to use a single HandlerExceptionResolver, despite multiple HandlerExceptionResolver beans being defined in the context.


setDetectAllViewResolvers

public void setDetectAllViewResolvers(boolean detectAllViewResolvers)
Set whether to detect all ViewResolver beans in this portlet's context. Else, just a single bean with name "viewResolver" will be expected.

Default is true. Turn this off if you want this portlet to use a single ViewResolver, despite multiple ViewResolver beans being defined in the context.


setViewRendererUrl

public void setViewRendererUrl(java.lang.String viewRendererUrl)
Set the URL to the ViewRendererServlet. That servlet is used to ultimately render all views in the portlet application.


onRefresh

public void onRefresh(ApplicationContext context)
This implementation calls initStrategies(org.springframework.context.ApplicationContext).

Overrides:
onRefresh in class FrameworkPortlet
Parameters:
context - the current Portlet ApplicationContext
See Also:
FrameworkPortlet.refresh()

initStrategies

protected void initStrategies(ApplicationContext context)
Refresh the strategy objects that this portlet uses.

May be overridden in subclasses in order to initialize further strategy objects.


initMultipartResolver

private void initMultipartResolver(ApplicationContext context)
Initialize the PortletMultipartResolver used by this class.

If no valid bean is defined with the given name in the BeanFactory for this namespace, no multipart handling is provided.


initHandlerMappings

private void initHandlerMappings(ApplicationContext context)
Initialize the HandlerMappings used by this class.

If no HandlerMapping beans are defined in the BeanFactory for this namespace, we default to PortletModeHandlerMapping.


initHandlerAdapters

private void initHandlerAdapters(ApplicationContext context)
Initialize the HandlerAdapters used by this class.

If no HandlerAdapter beans are defined in the BeanFactory for this namespace, we default to SimpleControllerHandlerAdapter.


initHandlerExceptionResolvers

private void initHandlerExceptionResolvers(ApplicationContext context)
Initialize the HandlerExceptionResolver used by this class.

If no bean is defined with the given name in the BeanFactory for this namespace, we default to no exception resolver.


initViewResolvers

private void initViewResolvers(ApplicationContext context)
Initialize the ViewResolvers used by this class.

If no ViewResolver beans are defined in the BeanFactory for this namespace, we default to InternalResourceViewResolver.


getDefaultStrategy

protected <T> T getDefaultStrategy(ApplicationContext context,
                                   java.lang.Class<T> strategyInterface)
Return the default strategy object for the given strategy interface.

The default implementation delegates to getDefaultStrategies(org.springframework.context.ApplicationContext, java.lang.Class), expecting a single object in the list.

Parameters:
context - the current Portlet ApplicationContext
strategyInterface - the strategy interface
Returns:
the corresponding strategy object
See Also:
getDefaultStrategies(org.springframework.context.ApplicationContext, java.lang.Class)

getDefaultStrategies

protected <T> java.util.List<T> getDefaultStrategies(ApplicationContext context,
                                                     java.lang.Class<T> strategyInterface)
Create a List of default strategy objects for the given strategy interface.

The default implementation uses the "DispatcherPortlet.properties" file (in the same package as the DispatcherPortlet class) to determine the class names. It instantiates the strategy objects and satisifies ApplicationContextAware if necessary.

Parameters:
context - the current Portlet ApplicationContext
strategyInterface - the strategy interface
Returns:
the List of corresponding strategy objects

createDefaultStrategy

protected java.lang.Object createDefaultStrategy(ApplicationContext context,
                                                 java.lang.Class<?> clazz)
Create a default strategy.

The default implementation uses AutowireCapableBeanFactory.createBean(java.lang.Class).

Parameters:
context - the current Portlet ApplicationContext
clazz - the strategy implementation class to instantiate
Returns:
the fully configured strategy instance
See Also:
ApplicationContext.getAutowireCapableBeanFactory()

getMultipartResolver

public PortletMultipartResolver getMultipartResolver()
Obtain this portlet's PortletMultipartResolver, if any.

Returns:
the PortletMultipartResolver used by this portlet, or null if none (indicating that no multipart support is available)

doActionService

protected void doActionService(ActionRequest request,
                               ActionResponse response)
                        throws java.lang.Exception
Processes the actual dispatching to the handler for action requests.

The handler will be obtained by applying the portlet's HandlerMappings in order. The HandlerAdapter will be obtained by querying the portlet's installed HandlerAdapters to find the first that supports the handler class.

Specified by:
doActionService in class FrameworkPortlet
Parameters:
request - current portlet action request
response - current portlet Action response
Throws:
java.lang.Exception - in case of any kind of processing failure
See Also:
javax.portlet.GenericPortlet#processAction

doRenderService

protected void doRenderService(RenderRequest request,
                               RenderResponse response)
                        throws java.lang.Exception
Processes the actual dispatching to the handler for render requests.

The handler will be obtained by applying the portlet's HandlerMappings in order. The HandlerAdapter will be obtained by querying the portlet's installed HandlerAdapters to find the first that supports the handler class.

Specified by:
doRenderService in class FrameworkPortlet
Parameters:
request - current portlet render request
response - current portlet render response
Throws:
java.lang.Exception - in case of any kind of processing failure
See Also:
javax.portlet.GenericPortlet#doDispatch

doResourceService

protected void doResourceService(ResourceRequest request,
                                 ResourceResponse response)
                          throws java.lang.Exception
Processes the actual dispatching to the handler for resource requests.

The handler will be obtained by applying the portlet's HandlerMappings in order. The HandlerAdapter will be obtained by querying the portlet's installed HandlerAdapters to find the first that supports the handler class.

Specified by:
doResourceService in class FrameworkPortlet
Parameters:
request - current portlet render request
response - current portlet render response
Throws:
java.lang.Exception - in case of any kind of processing failure
See Also:
javax.portlet.GenericPortlet#serveResource

doEventService

protected void doEventService(EventRequest request,
                              EventResponse response)
                       throws java.lang.Exception
Processes the actual dispatching to the handler for event requests.

The handler will be obtained by applying the portlet's HandlerMappings in order. The HandlerAdapter will be obtained by querying the portlet's installed HandlerAdapters to find the first that supports the handler class.

Specified by:
doEventService in class FrameworkPortlet
Parameters:
request - current portlet action request
response - current portlet Action response
Throws:
java.lang.Exception - in case of any kind of processing failure
See Also:
javax.portlet.GenericPortlet#processEvent

checkMultipart

protected ActionRequest checkMultipart(ActionRequest request)
                                throws MultipartException
Convert the request into a multipart request, and make multipart resolver available. If no multipart resolver is set, simply use the existing request.

Parameters:
request - current HTTP request
Returns:
the processed request (multipart wrapper if necessary)
Throws:
MultipartException

getHandler

protected HandlerExecutionChain getHandler(PortletRequest request)
                                    throws java.lang.Exception
Return the HandlerExecutionChain for this request. Try all handler mappings in order.

Parameters:
request - current portlet request
cache - whether to cache the HandlerExecutionChain in a request attribute
Returns:
the HandlerExceutionChain, or null if no handler could be found
Throws:
java.lang.Exception

noHandlerFound

protected void noHandlerFound(PortletRequest request,
                              PortletResponse response)
                       throws java.lang.Exception
No handler found -> throw appropriate exception.

Parameters:
request - current portlet request
response - current portlet response
Throws:
java.lang.Exception - if preparing the response failed

getHandlerAdapter

protected HandlerAdapter getHandlerAdapter(java.lang.Object handler)
                                    throws PortletException
Return the HandlerAdapter for this handler object.

Parameters:
handler - the handler object to find an adapter for
Throws:
PortletException - if no HandlerAdapter can be found for the handler. This is a fatal error.

exposeActionException

protected void exposeActionException(PortletRequest request,
                                     StateAwareResponse response,
                                     java.lang.Exception ex)
Expose the given action exception to the given response.

Parameters:
request - current portlet request
response - current portlet response
ex - the action exception (may also come from an event phase)

render

protected void render(ModelAndView mv,
                      PortletRequest request,
                      MimeResponse response)
               throws java.lang.Exception
Render the given ModelAndView. This is the last stage in handling a request. It may involve resolving the view by name.

Parameters:
mv - the ModelAndView to render
request - current portlet render request
response - current portlet render response
Throws:
java.lang.Exception - if there's a problem rendering the view

resolveViewName

protected View resolveViewName(java.lang.String viewName,
                               java.util.Map model,
                               PortletRequest request)
                        throws java.lang.Exception
Resolve the given view name into a View object (to be rendered).

Default implementations asks all ViewResolvers of this dispatcher. Can be overridden for custom resolution strategies, potentially based on specific model attributes or request parameters.

Parameters:
viewName - the name of the view to resolve
model - the model to be passed to the view
request - current portlet render request
Returns:
the View object, or null if none found
Throws:
java.lang.Exception - if the view cannot be resolved (typically in case of problems creating an actual View object)
See Also:
ViewResolver.resolveViewName(java.lang.String, java.util.Locale)

doRender

protected void doRender(View view,
                        java.util.Map model,
                        PortletRequest request,
                        MimeResponse response)
                 throws java.lang.Exception
Actually render the given view.

The default implementation delegates to ViewRendererServlet.

Parameters:
view - the View to render
model - the associated model
request - current portlet render request
response - current portlet render response
Throws:
java.lang.Exception - if there's a problem rendering the view

processHandlerException

protected ModelAndView processHandlerException(RenderRequest request,
                                               RenderResponse response,
                                               java.lang.Object handler,
                                               java.lang.Exception ex)
                                        throws java.lang.Exception
Determine an error ModelAndView via the registered HandlerExceptionResolvers.

Parameters:
request - current portlet request
response - current portlet 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

processHandlerException

protected ModelAndView processHandlerException(ResourceRequest request,
                                               ResourceResponse response,
                                               java.lang.Object handler,
                                               java.lang.Exception ex)
                                        throws java.lang.Exception
Determine an error ModelAndView via the registered HandlerExceptionResolvers.

Parameters:
request - current portlet request
response - current portlet 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

triggerAfterActionCompletion

private void triggerAfterActionCompletion(HandlerExecutionChain mappedHandler,
                                          int interceptorIndex,
                                          ActionRequest request,
                                          ActionResponse response,
                                          java.lang.Exception ex)
                                   throws java.lang.Exception
Trigger afterCompletion callbacks on the mapped HandlerInterceptors. Will just invoke afterCompletion for all interceptors whose preHandle invocation has successfully completed and returned true.

Parameters:
mappedHandler - the mapped HandlerExecutionChain
interceptorIndex - index of last interceptor that successfully completed
ex - Exception thrown on handler execution, or null if none
Throws:
java.lang.Exception
See Also:
HandlerInterceptor.afterRenderCompletion(RenderRequest, RenderResponse, java.lang.Object, java.lang.Exception)

triggerAfterRenderCompletion

private void triggerAfterRenderCompletion(HandlerExecutionChain mappedHandler,
                                          int interceptorIndex,
                                          RenderRequest request,
                                          RenderResponse response,
                                          java.lang.Exception ex)
                                   throws java.lang.Exception
Trigger afterCompletion callbacks on the mapped HandlerInterceptors. Will just invoke afterCompletion for all interceptors whose preHandle invocation has successfully completed and returned true.

Parameters:
mappedHandler - the mapped HandlerExecutionChain
interceptorIndex - index of last interceptor that successfully completed
ex - Exception thrown on handler execution, or null if none
Throws:
java.lang.Exception
See Also:
HandlerInterceptor.afterRenderCompletion(RenderRequest, RenderResponse, java.lang.Object, java.lang.Exception)

triggerAfterResourceCompletion

private void triggerAfterResourceCompletion(HandlerExecutionChain mappedHandler,
                                            int interceptorIndex,
                                            ResourceRequest request,
                                            ResourceResponse response,
                                            java.lang.Exception ex)
                                     throws java.lang.Exception
Trigger afterCompletion callbacks on the mapped HandlerInterceptors. Will just invoke afterCompletion for all interceptors whose preHandle invocation has successfully completed and returned true.

Parameters:
mappedHandler - the mapped HandlerExecutionChain
interceptorIndex - index of last interceptor that successfully completed
ex - Exception thrown on handler execution, or null if none
Throws:
java.lang.Exception
See Also:
HandlerInterceptor.afterRenderCompletion(RenderRequest, RenderResponse, java.lang.Object, java.lang.Exception)

triggerAfterEventCompletion

private void triggerAfterEventCompletion(HandlerExecutionChain mappedHandler,
                                         int interceptorIndex,
                                         EventRequest request,
                                         EventResponse response,
                                         java.lang.Exception ex)
                                  throws java.lang.Exception
Trigger afterCompletion callbacks on the mapped HandlerInterceptors. Will just invoke afterCompletion for all interceptors whose preHandle invocation has successfully completed and returned true.

Parameters:
mappedHandler - the mapped HandlerExecutionChain
interceptorIndex - index of last interceptor that successfully completed
ex - Exception thrown on handler execution, or null if none
Throws:
java.lang.Exception
See Also:
HandlerInterceptor.afterRenderCompletion(RenderRequest, RenderResponse, java.lang.Object, java.lang.Exception)