Package org.bremersee.web.servlet
Class ApiExceptionResolver
- java.lang.Object
-
- org.bremersee.web.servlet.ApiExceptionResolver
-
- All Implemented Interfaces:
org.springframework.web.servlet.HandlerExceptionResolver
@Validated public class ApiExceptionResolver extends Object implements org.springframework.web.servlet.HandlerExceptionResolver
The api exception resolver.- Author:
- Christian Bremer
-
-
Constructor Summary
Constructors Constructor Description ApiExceptionResolver(RestApiExceptionMapper exceptionMapper)
Instantiates a new api exception resolver.ApiExceptionResolver(RestApiExceptionMapper exceptionMapper, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper)
Instantiates a new api exception resolver.ApiExceptionResolver(RestApiExceptionMapper exceptionMapper, org.springframework.http.converter.json.Jackson2ObjectMapperBuilder objectMapperBuilder)
Instantiates a new api exception resolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyStatusCodeIfPossible(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int statusCode)
Apply status code if possible.protected boolean
isExceptionHandlerResponsible(javax.servlet.http.HttpServletRequest request, Object handler)
Is this exception handler responsible.org.springframework.web.servlet.ModelAndView
resolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex)
-
-
-
Field Detail
-
MODEL_KEY
protected static final String MODEL_KEY
The constant MODEL_KEY.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ApiExceptionResolver
public ApiExceptionResolver(RestApiExceptionMapper exceptionMapper)
Instantiates a new api exception resolver.- Parameters:
exceptionMapper
- the exception mapper
-
ApiExceptionResolver
public ApiExceptionResolver(RestApiExceptionMapper exceptionMapper, org.springframework.http.converter.json.Jackson2ObjectMapperBuilder objectMapperBuilder)
Instantiates a new api exception resolver.- Parameters:
exceptionMapper
- the exception mapperobjectMapperBuilder
- the object mapper builder
-
ApiExceptionResolver
public ApiExceptionResolver(RestApiExceptionMapper exceptionMapper, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper)
Instantiates a new api exception resolver.- Parameters:
exceptionMapper
- the exception mapperobjectMapper
- the object mapperxmlMapper
- the xml mapper
-
-
Method Detail
-
resolveException
public org.springframework.web.servlet.ModelAndView resolveException(@NonNull javax.servlet.http.HttpServletRequest request, @NonNull javax.servlet.http.HttpServletResponse response, @Nullable Object handler, @NonNull Exception ex)
- Specified by:
resolveException
in interfaceorg.springframework.web.servlet.HandlerExceptionResolver
-
isExceptionHandlerResponsible
protected boolean isExceptionHandlerResponsible(javax.servlet.http.HttpServletRequest request, @Nullable Object handler)
Is this exception handler responsible.- Parameters:
request
- the requesthandler
- the handler- Returns:
true
if it is responsible, otherwisefalse
-
applyStatusCodeIfPossible
protected final void applyStatusCodeIfPossible(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int statusCode)
Apply status code if possible.- Parameters:
request
- the requestresponse
- the responsestatusCode
- the status code
-
-