Package io.nuov.spring.error
Class AbstractResponseEntityExceptionHandler
java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
io.nuov.spring.error.AbstractResponseEntityExceptionHandler
- All Implemented Interfaces:
io.nuov.logging.LoggingDependency,org.springframework.beans.factory.Aware,org.springframework.context.MessageSourceAware
public abstract class AbstractResponseEntityExceptionHandler
extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
implements io.nuov.logging.LoggingDependency
The class AbstractResponseEntityExceptionHandler.
-
Field Summary
Fields inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.slf4j.Loggerorg.springframework.http.ResponseEntity<Object>Handles all other Exceptions.protected org.springframework.http.ResponseEntity<Object>handleBadRequest(io.nuov.error.BadRequestException badRequestException) Handles BadRequestException.protected org.springframework.http.ResponseEntity<Object>handleForbidden(io.nuov.error.ForbiddenException forbiddenException) Handles ForbiddenException.protected org.springframework.http.ResponseEntity<Object>handleHttpMediaTypeNotSupported(org.springframework.web.HttpMediaTypeNotSupportedException httpMediaTypeNotSupportedException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) protected org.springframework.http.ResponseEntity<Object>handleHttpMessageNotReadable(org.springframework.http.converter.HttpMessageNotReadableException httpMessageNotReadableException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) protected org.springframework.http.ResponseEntity<Object>handleHttpMessageNotWritable(org.springframework.http.converter.HttpMessageNotWritableException httpMessageNotWritableException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) protected org.springframework.http.ResponseEntity<Object>handleHttpRequestMethodNotSupported(org.springframework.web.HttpRequestMethodNotSupportedException httpRequestMethodNotSupportedException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) protected org.springframework.http.ResponseEntity<Object>handleLocked(io.nuov.error.LockedException lockedException) Handles LockedException.protected org.springframework.http.ResponseEntity<Object>handleMissingServletRequestParameter(org.springframework.web.bind.MissingServletRequestParameterException missingServletRequestParameterException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) protected org.springframework.http.ResponseEntity<Object>handleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException noHandlerFoundException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) protected org.springframework.http.ResponseEntity<Object>handleNotFound(io.nuov.error.NotFoundException notFoundException) Handles NotFoundException.protected org.springframework.http.ResponseEntity<Object>handleNotModified(io.nuov.error.NotModifiedException notModifiedException) Handles NotModifiedException.protected org.springframework.http.ResponseEntity<Object>handleServiceUnavailable(io.nuov.error.ServiceUnavailableException serviceUnavailableException) Handles ServiceUnavailableException.protected org.springframework.http.ResponseEntity<Object>handleUnauthorized(io.nuov.error.UnauthorizedException unauthorizedException) Handles UnauthorizedException.protected voidlogException(Exception exception, org.springframework.web.context.request.WebRequest webRequest) Logs the exception.protected abstract voidreportException(Exception exception, org.springframework.web.context.request.WebRequest webRequest) Reports the exception.Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
createProblemDetail, createResponseEntity, getMessageSource, handleAsyncRequestNotUsableException, handleAsyncRequestTimeoutException, handleConversionNotSupported, handleErrorResponseException, handleException, handleExceptionInternal, handleHandlerMethodValidationException, handleHttpMediaTypeNotAcceptable, handleMaxUploadSizeExceededException, handleMethodArgumentNotValid, handleMethodValidationException, handleMissingPathVariable, handleMissingServletRequestPart, handleNoResourceFoundException, handleServletRequestBindingException, handleTypeMismatch, setMessageSource
-
Constructor Details
-
AbstractResponseEntityExceptionHandler
public AbstractResponseEntityExceptionHandler()
-
-
Method Details
-
getLogger
public org.slf4j.Logger getLogger()- Specified by:
getLoggerin interfaceio.nuov.logging.LoggingDependency
-
handleAll
@ExceptionHandler(java.lang.Exception.class) public org.springframework.http.ResponseEntity<Object> handleAll(Exception exception, org.springframework.web.context.request.WebRequest webRequest) Handles all other Exceptions.- Parameters:
exception- the exceptionwebRequest- the web request- Returns:
- the response entity
-
handleBadRequest
@ExceptionHandler(io.nuov.error.BadRequestException.class) protected org.springframework.http.ResponseEntity<Object> handleBadRequest(io.nuov.error.BadRequestException badRequestException) Handles BadRequestException.- Parameters:
badRequestException- the BadRequestException- Returns:
- the response entity
-
handleForbidden
@ExceptionHandler(io.nuov.error.ForbiddenException.class) protected org.springframework.http.ResponseEntity<Object> handleForbidden(io.nuov.error.ForbiddenException forbiddenException) Handles ForbiddenException.- Parameters:
forbiddenException- the ForbiddenException- Returns:
- the response entity
-
handleHttpMediaTypeNotSupported
protected org.springframework.http.ResponseEntity<Object> handleHttpMediaTypeNotSupported(org.springframework.web.HttpMediaTypeNotSupportedException httpMediaTypeNotSupportedException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) - Overrides:
handleHttpMediaTypeNotSupportedin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleHttpMessageNotReadable
protected org.springframework.http.ResponseEntity<Object> handleHttpMessageNotReadable(org.springframework.http.converter.HttpMessageNotReadableException httpMessageNotReadableException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) - Overrides:
handleHttpMessageNotReadablein classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleHttpMessageNotWritable
protected org.springframework.http.ResponseEntity<Object> handleHttpMessageNotWritable(org.springframework.http.converter.HttpMessageNotWritableException httpMessageNotWritableException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) - Overrides:
handleHttpMessageNotWritablein classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleHttpRequestMethodNotSupported
protected org.springframework.http.ResponseEntity<Object> handleHttpRequestMethodNotSupported(org.springframework.web.HttpRequestMethodNotSupportedException httpRequestMethodNotSupportedException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) - Overrides:
handleHttpRequestMethodNotSupportedin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleLocked
@ExceptionHandler(io.nuov.error.LockedException.class) protected org.springframework.http.ResponseEntity<Object> handleLocked(io.nuov.error.LockedException lockedException) Handles LockedException.- Parameters:
lockedException- the LockedException- Returns:
- the response entity
-
handleMissingServletRequestParameter
protected org.springframework.http.ResponseEntity<Object> handleMissingServletRequestParameter(org.springframework.web.bind.MissingServletRequestParameterException missingServletRequestParameterException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) - Overrides:
handleMissingServletRequestParameterin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleNoHandlerFoundException
protected org.springframework.http.ResponseEntity<Object> handleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException noHandlerFoundException, org.springframework.http.HttpHeaders httpHeaders, org.springframework.http.HttpStatusCode httpStatusCode, org.springframework.web.context.request.WebRequest webRequest) - Overrides:
handleNoHandlerFoundExceptionin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleNotFound
@ExceptionHandler(io.nuov.error.NotFoundException.class) protected org.springframework.http.ResponseEntity<Object> handleNotFound(io.nuov.error.NotFoundException notFoundException) Handles NotFoundException.- Parameters:
notFoundException- the NotFoundException- Returns:
- the response entity
-
handleNotModified
@ExceptionHandler(io.nuov.error.NotModifiedException.class) protected org.springframework.http.ResponseEntity<Object> handleNotModified(io.nuov.error.NotModifiedException notModifiedException) Handles NotModifiedException.- Parameters:
notModifiedException- the NotModifiedException- Returns:
- the response entity
-
handleUnauthorized
@ExceptionHandler(io.nuov.error.UnauthorizedException.class) protected org.springframework.http.ResponseEntity<Object> handleUnauthorized(io.nuov.error.UnauthorizedException unauthorizedException) Handles UnauthorizedException.- Parameters:
unauthorizedException- the UnauthorizedException- Returns:
- the response entity
-
logException
protected void logException(Exception exception, org.springframework.web.context.request.WebRequest webRequest) Logs the exception.This method exists to be overridden.
- Parameters:
exception- the exceptionwebRequest- the web request
-
reportException
protected abstract void reportException(Exception exception, org.springframework.web.context.request.WebRequest webRequest) Reports the exception.- Parameters:
exception- the exceptionwebRequest- the web request
-