HandlerExceptionResolver implementations.
Supports mapped handlers and
handler classes that the resolver
should be applied to and implements the Ordered interface.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| protected final Log | logger
Logger available to subclasses. |
| private Class | |
| private Predicate | |
| private Set | |
| private int | |
| private boolean | |
| private Log |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected String | Returns: the log message to usethe exception that got thrown during handler execution ex, HttpServletRequest current HTTP request (useful for obtaining metadata) request)Build a log message for the given exception, occurred during processing the given request. |
| protected abstract ModelAndView | Returns: a correspondingModelAndView to forward to,
or null for default processing in the resolution chaincurrent HTTP request request, HttpServletResponse current HTTP response response, Object the executed handler, or handler, Exception null if none chosen at the time
of the exception (for example, if multipart resolution failed)the exception that got thrown during handler execution ex)Actually resolve the given exception that got thrown during handler execution,
returning a |
| protected Class | |
| public int | |
| protected boolean | hasHandlerMappings()
Whether there are any handler mappings registered via
|
| protected void | logException(Exception
the exception that got thrown during handler execution ex, HttpServletRequest current HTTP request (useful for obtaining metadata) request)Log the given exception at warn level, provided that warn logging has been
activated through the |
| protected void | prepareResponse(Exception
the exception that got thrown during handler execution ex, HttpServletResponse current HTTP response response)Prepare the response for the exceptional case. |
| protected void | preventCaching(HttpServletResponse
current HTTP response response)Prevents the response from being cached, through setting corresponding
HTTP |
| public ModelAndView | resolveException(HttpServletRequest
current HTTP request request, HttpServletResponse current HTTP response response, Object the executed handler, or handler, Exception null if none chosen at the
time of the exception (for example, if multipart resolution failed)the exception that got thrown during handler execution ex)Implements org. Check whether this resolver is supposed to apply (i.e. if the supplied handler
matches any of the configured handlers or
handler classes), and then delegate
to the |
| public void | setMappedHandlerClasses(Class<?>... mappedHandlerClasses)
Specify the set of classes that this exception resolver should apply to. |
| public void | setMappedHandlerPredicate(Predicate<Object> predicate)
Use a |
| public void | setMappedHandlers(Set<?> mappedHandlers)
Specify the set of handlers that this exception resolver should apply to. |
| public void | |
| public void | setPreventResponseCaching(boolean preventResponseCaching)
Specify whether to prevent HTTP response caching for any view resolved by this exception resolver. |
| public void | |
| protected boolean | Returns: whether this resolved should proceed with resolving the exception for the given request and handlercurrent HTTP request request, Object the executed handler, or handler)null if none chosen
at the time of the exception (for example, if multipart resolution failed)Check whether this resolver is supposed to apply to the given handler. |
| HEADER_CACHE_CONTROL | back to summary |
|---|---|
| private static final String HEADER_CACHE_CONTROL | |
| logger | back to summary |
|---|---|
| protected final Log logger Logger available to subclasses. | |
| mappedHandlerClasses | back to summary |
|---|---|
| private Class<?>[] mappedHandlerClasses
| |
| mappedHandlerPredicate | back to summary |
|---|---|
| private Predicate<Object> mappedHandlerPredicate
| |
| mappedHandlers | back to summary |
|---|---|
| private Set<?> mappedHandlers
| |
| order | back to summary |
|---|---|
| private int order | |
| preventResponseCaching | back to summary |
|---|---|
| private boolean preventResponseCaching | |
| warnLogger | back to summary |
|---|---|
| private Log warnLogger
| |
| AbstractHandlerExceptionResolver | back to summary |
|---|---|
| public AbstractHandlerExceptionResolver() | |
| addMappedHandlerClass | back to summary |
|---|---|
| public void addMappedHandlerClass(Class<?> mappedHandlerClass) Alternative to
| |
| buildLogMessage | back to summary |
|---|---|
| protected String buildLogMessage(Exception ex, HttpServletRequest request) Build a log message for the given exception, occurred during processing the given request.
| |
| doResolveException | back to summary |
|---|---|
| protected abstract ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Actually resolve the given exception that got thrown during handler execution,
returning a May be overridden in subclasses, in order to apply specific exception checks. Note that this template method will be invoked after checking whether this resolver applies ("mappedHandlers" etc), so an implementation may simply proceed with its actual exception handling.
| |
| getMappedHandlerClasses | back to summary |
|---|---|
| protected Class Return the
| |
| getOrder | back to summary |
|---|---|
| public int getOrder() Implements org. Doc from org. 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 Same order values will result in arbitrary sort positions for the affected objects.
| |
| hasHandlerMappings | back to summary |
|---|---|
| protected boolean hasHandlerMappings() Whether there are any handler mappings registered via
| |
| logException | back to summary |
|---|---|
| protected void logException(Exception ex, HttpServletRequest request) Log the given exception at warn level, provided that warn logging has been
activated through the Calls
| |
| prepareResponse | back to summary |
|---|---|
| protected void prepareResponse(Exception ex, HttpServletResponse response) Prepare the response for the exceptional case. The default implementation prevents the response from being cached,
if the
| |
| preventCaching | back to summary |
|---|---|
| protected void preventCaching(HttpServletResponse response) Prevents the response from being cached, through setting corresponding
HTTP
| |
| resolveException | back to summary |
|---|---|
| public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Implements org. Check whether this resolver is supposed to apply (i.e. if the supplied handler
matches any of the configured handlers or
handler classes), and then delegate
to the
| |
| setMappedHandlerClasses | back to summary |
|---|---|
| public void setMappedHandlerClasses(Class<?>... mappedHandlerClasses) Specify the set of classes that this exception resolver should apply to. The resolver will only apply to handlers of the specified types; the specified types may be interfaces or superclasses of handlers as well. If no handler predicate, nor handlers, nor handler classes are set, the exception resolver applies to all handlers.
| |
| setMappedHandlerPredicate | back to summary |
|---|---|
| public void setMappedHandlerPredicate(Predicate<Object> predicate) Use a If no handler predicate, nor handlers, nor handler classes are set, the exception resolver applies to all handlers.
| |
| setMappedHandlers | back to summary |
|---|---|
| public void setMappedHandlers(Set<?> mappedHandlers) Specify the set of handlers that this exception resolver should apply to. If no handler predicate, nor handlers, nor handler classes are set, the exception resolver applies to all handlers.
| |
| setOrder | back to summary |
|---|---|
| public void setOrder(int order) | |
| setPreventResponseCaching | back to summary |
|---|---|
| public void setPreventResponseCaching(boolean preventResponseCaching) Specify whether to prevent HTTP response caching for any view resolved by this exception resolver. Default is | |
| setWarnLogCategory | back to summary |
|---|---|
| public void setWarnLogCategory(String loggerName) Set the log category for warn logging. The name will be passed to the underlying logger
implementation through Commons Logging, getting interpreted as a log category according
to the logger's configuration. If By default there is no warn logging although subclasses like
| |
| shouldApplyTo | back to summary |
|---|---|
| protected boolean shouldApplyTo(HttpServletRequest request, Object handler) Check whether this resolver is supposed to apply to the given handler. The default implementation checks against the configured handlerPredicate handlers and handler classes, if any.
| |