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.
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 Summary
Modifier and TypeMethodDescriptionresolveErrorView(jakarta.servlet.http.HttpServletRequest request, ProblemDetail problemDetail, @Nullable ErrorResponse errorResponse) Resolve the view to render for the given problem detail.
-
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
ModelAndViewcan declare a status; by default, the status of the response entity or problem detail is used.- Parameters:
request- the current requestproblemDetail- the problem detail to rendererrorResponse- the error response the problem detail is from, if any- Returns:
- the
ModelAndViewto render, ornullto write the problem detail with message converters
-