Package net.shibboleth.ext.spring.error
Class ExtendedMappingExceptionResolver
java.lang.Object
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
net.shibboleth.ext.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 static final StringModel attribute carrying theHTMLEncoderclass.private static final StringModel attribute carryingHttpServletRequest.private static final StringModel attribute carryingHttpServletResponse.private static final StringModel attribute carryingWebApplicationContext.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.ExtendedMappingExceptionResolver(Function<javax.servlet.http.HttpServletRequest, Map<String, Object>> extender) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected ModelAndViewdoResolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex) protected ModelAndViewgetModelAndView(String viewName, Exception ex, javax.servlet.http.HttpServletRequest request) 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
buildLogMessage, getOrder, hasHandlerMappings, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, 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_ENCODER
Model attribute carrying theHTMLEncoderclass.- See Also:
-
viewModelExtenderFunction
@Nullable private Function<javax.servlet.http.HttpServletRequest,Map<String, viewModelExtenderFunctionObject>> Function to obtain extensions to view model.
-
-
Constructor Details
-
ExtendedMappingExceptionResolver
public ExtendedMappingExceptionResolver()Constructor. -
ExtendedMappingExceptionResolver
public ExtendedMappingExceptionResolver(@Nullable Function<javax.servlet.http.HttpServletRequest, Map<String, Object>> extender) Constructor.- Parameters:
extender- function to obtain extensions to view model
-
-
Method Details
-
doResolveException
protected ModelAndView doResolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex) - Overrides:
doResolveExceptionin classSimpleMappingExceptionResolver
-
getModelAndView
protected ModelAndView getModelAndView(String viewName, Exception ex, javax.servlet.http.HttpServletRequest request) - Overrides:
getModelAndViewin classSimpleMappingExceptionResolver
-