Top Description Methods
org.springframework.web.servlet

public Interface HandlerExceptionResolver

Known Direct Implementers
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver, org.springframework.web.servlet.handler.HandlerExceptionResolverComposite
Imports
jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.springframework.lang.Nullable

Interface to be implemented by objects that can resolve exceptions thrown during handler mapping or execution, in the typical case to error views. Implementors are typically registered as beans in the application context.

Error views are analogous to JSP error pages but can be used with any kind of exception including any checked exception, with potentially fine-grained mappings for specific handlers.

Author
Juergen Hoeller
Since
22.11.2003

Method Summary

Modifier and TypeMethod and Description
public ModelAndView

Returns:

a corresponding ModelAndView to forward to, or null for default processing in the resolution chain
resolveException
(HttpServletRequest
current HTTP request
request
,
HttpServletResponse
current HTTP response
response
,
Object
the executed handler, or null if none chosen at the time of the exception (for example, if multipart resolution failed)
handler
,
Exception
the exception that got thrown during handler execution
ex
)

Try to resolve the given exception that got thrown during handler execution, returning a ModelAndView that represents a specific error page if appropriate.

Method Detail

resolveExceptionback to summary
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)

Try to resolve the given exception that got thrown during handler execution, returning a ModelAndView that represents a specific error page if appropriate.

The returned ModelAndView may be empty to indicate that the exception has been resolved successfully but that no view should be rendered, for instance by setting a status code.

Parameters
request:HttpServletRequest

current HTTP request

response:HttpServletResponse

current HTTP response

handler:Object

the executed handler, or null if none chosen at the time of the exception (for example, if multipart resolution failed)

ex:Exception

the exception that got thrown during handler execution

Returns:ModelAndView

a corresponding ModelAndView to forward to, or null for default processing in the resolution chain

Annotations
@Nullable