Class ErrorPageViewResolver
java.lang.Object
com.irurueta.authserver.authorization.api.web.error.ErrorPageViewResolver
- All Implemented Interfaces:
org.springframework.boot.webmvc.autoconfigure.error.ErrorViewResolver
@Component
public class ErrorPageViewResolver
extends Object
implements org.springframework.boot.webmvc.autoconfigure.error.ErrorViewResolver
Chooses the error page Spring Boot's
BasicErrorController renders for a browser: the error template
with a generic text picked from the status only, and the branding. The model the controller offers (timestamp, path,
exception, ...) is deliberately not passed on, so the page never shows a stack trace, an exception message, the
requested path or anything else that could leak internals. Clients that do not accept HTML get the controller's
JSON body, which spring.web.error.include-* keeps to the timestamp, the status and its reason phrase.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BrandingProviderSupplies the branding of the pages.(package private) static final StringMessage key shown for a forbidden request.(package private) static final StringMessage key shown for any other error.(package private) static final StringName of the model attribute that holds the key of the message to show.(package private) static final StringMessage key shown for a missing page.(package private) static final StringName of the error template. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.web.servlet.ModelAndViewresolveErrorView(jakarta.servlet.http.HttpServletRequest request, org.springframework.http.HttpStatus status, Map<String, Object> model) Resolves the error page of a status.
-
Field Details
-
VIEW_NAME
Name of the error template.- See Also:
-
MESSAGE_ATTRIBUTE
Name of the model attribute that holds the key of the message to show.- See Also:
-
NOT_FOUND_KEY
Message key shown for a missing page.- See Also:
-
FORBIDDEN_KEY
Message key shown for a forbidden request.- See Also:
-
GENERIC_KEY
Message key shown for any other error.- See Also:
-
brandingProvider
Supplies the branding of the pages.
-
-
Constructor Details
-
ErrorPageViewResolver
public ErrorPageViewResolver()
-
-
Method Details
-
resolveErrorView
public org.springframework.web.servlet.ModelAndView resolveErrorView(jakarta.servlet.http.HttpServletRequest request, org.springframework.http.HttpStatus status, Map<String, Object> model) Resolves the error page of a status.- Specified by:
resolveErrorViewin interfaceorg.springframework.boot.webmvc.autoconfigure.error.ErrorViewResolver- Parameters:
request- the forwarded request.status- status of the failed request.model- model offered by the error controller; not used, so none of its details reach the page.- Returns:
- the error view, with the message key and the branding, answered with the status.
-