Interface ErrorResponseViewResolver

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ErrorResponseViewResolver
Strategy to render an RFC 9457 ProblemDetail as a view, typically an HTML error page, instead of writing it with message converters.

This is called when handling ProblemDetail, ErrorResponse and ResponseEntity<ProblemDetail> values, if the client prefers HTML through content negotiation. This applies to problem details returned by @ExceptionHandler methods.

Before view resolution, the problem detail is passed to ErrorResponse.Interceptors, so that it has the same content as when it is written with message converters.

Since:
7.1
Author:
Brian Clozel
See Also:
  • Method Details

    • resolveErrorView

      @Nullable ModelAndView resolveErrorView(jakarta.servlet.http.HttpServletRequest request, ProblemDetail problemDetail, @Nullable ErrorResponse errorResponse)
      Resolve the view to render for the given problem detail.

      The returned ModelAndView can declare a status; by default, the status of the response entity or problem detail is used.

      Parameters:
      request - the current request
      problemDetail - the problem detail to render
      errorResponse - the error response the problem detail is from, if any
      Returns:
      the ModelAndView to render, or null to write the problem detail with message converters