Class ExtendedMappingExceptionResolver
java.lang.Object
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
net.shibboleth.shared.spring.error.ExtendedMappingExceptionResolver
- All Implemented Interfaces:
Ordered,HandlerExceptionResolver
Custom Spring exception to view mapper that populates the view model with data
obtained via an extension function.
As a default, the view model will include a reference to the active HttpServletRequest
and the HTMLEncoder class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringDigesterCSP digester.private IdentifierGenerationStrategyCSP nonce generator.private ObjectSlot for custom view object to inject.private static final StringModel attribute carrying the custom object.private static final StringModel attribute carrying the CSP digester.private static final StringModel attribute carrying theHTMLEncoderclass.private static final StringModel attribute carryingEnvironmentCapable.getEnvironment().private static final StringModel attribute carrying the CSP nonce generator.private static final StringModel attribute carryingHttpServletRequest.private static final StringModel attribute carryingHttpServletResponse.private static final StringModel attribute carryingWebApplicationContext.private final Function<HttpServletRequest,Map<String, Object>> Function to obtain extensions to view model.Fields inherited from class org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
DEFAULT_EXCEPTION_ATTRIBUTEFields inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
loggerFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected ModelAndViewdoResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) protected ModelAndViewgetModelAndView(String viewName, Exception ex, HttpServletRequest request) voidsetCSPDigester(StringDigester digester) Sets a CSP digester.voidsetCSPNonceGenerator(IdentifierGenerationStrategy generator) Sets a CSP nonce generator.voidsetCustomObject(Object custom) Sets a custom object to inject into the view.Methods inherited from class org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
addStatusCode, applyStatusCodeIfPossible, determineStatusCode, determineViewName, findMatchingViewName, getDepth, getModelAndView, getStatusCodesAsMap, setDefaultErrorView, setDefaultStatusCode, setExceptionAttribute, setExceptionMappings, setExcludedExceptions, setStatusCodesMethods inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
addMappedHandlerClass, buildLogMessage, getMappedHandlerClasses, getOrder, hasHandlerMappings, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, setMappedHandlerPredicate, setMappedHandlers, setOrder, setPreventResponseCaching, setWarnLogCategory, shouldApplyTo
-
Field Details
-
MODEL_ATTR_REQUEST
Model attribute carryingHttpServletRequest.- See Also:
-
MODEL_ATTR_RESPONSE
Model attribute carryingHttpServletResponse.- See Also:
-
MODEL_ATTR_SPRINGCONTEXT
Model attribute carryingWebApplicationContext.- See Also:
-
MODEL_ATTR_ENVIRONMENT
Model attribute carryingEnvironmentCapable.getEnvironment().- See Also:
-
MODEL_ATTR_ENCODER
Model attribute carrying theHTMLEncoderclass.- See Also:
-
MODEL_ATTR_DIGESTER
Model attribute carrying the CSP digester.- See Also:
-
MODEL_ATTR_NONCE
Model attribute carrying the CSP nonce generator.- See Also:
-
MODEL_ATTR_CUSTOM
Model attribute carrying the custom object.- See Also:
-
viewModelExtenderFunction
Function to obtain extensions to view model. -
cspDigester
CSP digester. -
cspNonceGenerator
CSP nonce generator. -
customObject
Slot for custom view object to inject.
-
-
Constructor Details
-
ExtendedMappingExceptionResolver
public ExtendedMappingExceptionResolver()Constructor. -
ExtendedMappingExceptionResolver
public ExtendedMappingExceptionResolver(@Nullable Function<HttpServletRequest, Map<String, Object>> extender) Constructor.- Parameters:
extender- function to obtain extensions to view model
-
-
Method Details
-
setCustomObject
Sets a custom object to inject into the view.- Parameters:
custom- custom object- Since:
- 9.1.0
-
doResolveException
protected ModelAndView doResolveException(@Nonnull HttpServletRequest request, @Nonnull HttpServletResponse response, @Nullable Object handler, @Nonnull Exception ex) - Overrides:
doResolveExceptionin classSimpleMappingExceptionResolver
-
getModelAndView
@Nonnull protected ModelAndView getModelAndView(@Nonnull String viewName, @Nonnull Exception ex, @Nonnull HttpServletRequest request) - Overrides:
getModelAndViewin classSimpleMappingExceptionResolver