Spring Framework

org.springframework.web.servlet.handler
Class HandlerExceptionResolverComposite

java.lang.Object
  extended by org.springframework.web.servlet.handler.HandlerExceptionResolverComposite
All Implemented Interfaces:
Ordered, HandlerExceptionResolver

public class HandlerExceptionResolverComposite
extends java.lang.Object
implements HandlerExceptionResolver, Ordered

A HandlerExceptionResolver that delegates to a list of other HandlerExceptionResolvers.

Since:
3.1
Author:
Rossen Stoyanchev

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
HandlerExceptionResolverComposite()
           
 
Method Summary
 java.util.List<HandlerExceptionResolver> getExceptionResolvers()
          Return the list of exception resolvers to delegate to.
 int getOrder()
          Return the order value of this object, with a higher value meaning greater in terms of sorting.
 ModelAndView resolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, java.lang.Exception ex)
          Resolve the exception by iterating over the list of configured exception resolvers.
 void setExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
          Set the list of exception resolvers to delegate to.
 void setOrder(int order)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerExceptionResolverComposite

public HandlerExceptionResolverComposite()
Method Detail

setOrder

public void setOrder(int order)

getOrder

public int getOrder()
Description copied from interface: Ordered
Return the order value of this object, with a higher value meaning greater in terms of sorting.

Normally starting with 0, with Integer.MAX_VALUE indicating the greatest value. Same order values will result in arbitrary positions for the affected objects.

Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).

Specified by:
getOrder in interface Ordered
Returns:
the order value

setExceptionResolvers

public void setExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
Set the list of exception resolvers to delegate to.


getExceptionResolvers

public java.util.List<HandlerExceptionResolver> getExceptionResolvers()
Return the list of exception resolvers to delegate to.


resolveException

public ModelAndView resolveException(javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.Object handler,
                                     java.lang.Exception ex)
Resolve the exception by iterating over the list of configured exception resolvers. The first one to return a ModelAndView instance wins. Otherwise null is returned.

Specified by:
resolveException in interface HandlerExceptionResolver
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, or null for default processing

Spring Framework