Class HandlerExceptionResolverComposite
java.lang.Object
org.springframework.web.servlet.handler.HandlerExceptionResolverComposite
- All Implemented Interfaces:
Ordered
,HandlerExceptionResolver
public class HandlerExceptionResolverComposite
extends 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
-
Method Summary
Modifier and TypeMethodDescriptionReturn the list of exception resolvers to delegate to.int
getOrder()
Get the order value of this object.resolveException
(HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) Resolve the exception by iterating over the list of configured exception resolvers.void
setExceptionResolvers
(List<HandlerExceptionResolver> exceptionResolvers) Set the list of exception resolvers to delegate to.void
setOrder
(int order)
-
Constructor Details
-
HandlerExceptionResolverComposite
public HandlerExceptionResolverComposite()
-
-
Method Details
-
setExceptionResolvers
Set the list of exception resolvers to delegate to. -
getExceptionResolvers
Return the list of exception resolvers to delegate to. -
setOrder
public void setOrder(int order) -
getOrder
public int getOrder()Description copied from interface:Ordered
Get the order value of this object.Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet
load-on-startup
values).Same order values will result in arbitrary sort positions for the affected objects.
-
resolveException
public @Nullable ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) Resolve the exception by iterating over the list of configured exception resolvers.The first one to return a
ModelAndView
wins. Otherwisenull
is returned.- Specified by:
resolveException
in interfaceHandlerExceptionResolver
- Parameters:
request
- current HTTP requestresponse
- current HTTP responsehandler
- the executed handler, ornull
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, ornull
for default processing in the resolution chain
-