Class SpringMvcExceptionHandler
java.lang.Object
org.frankframework.console.exceptions.SpringMvcExceptionHandler
Taken partially from
ResponseEntityExceptionHandler.handleException(Exception, WebRequest).
This ExceptionHandler catches Spring HTTP related MVC exceptions,
as well as IO related exceptions.
Catch all Spring web exceptions (such as subclasses of ServletException), even when they are not thrown from our own sources.
We need to prioritize this so our handler is used before Spring's own ExceptionHandler.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final org.springframework.http.ResponseEntity<Object> These Exceptions all implementErrorResponseso they come pre-configured with a status-code and headers.protected final org.springframework.http.ResponseEntity<Object> Lower level bean-exceptionsprotected org.springframework.http.ResponseEntity<Object> handleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException ex) When aRestControllercannot be found, Spring MVC throws this Exception.protected org.springframework.http.ResponseEntity<Object> handleSpringException(Exception exception, org.springframework.http.HttpStatusCode status, @Nullable org.springframework.http.HttpHeaders headers)
-
Constructor Details
-
SpringMvcExceptionHandler
public SpringMvcExceptionHandler()
-
-
Method Details
-
handleException
@ExceptionHandler({org.springframework.web.bind.MethodArgumentNotValidException.class,org.springframework.web.context.request.async.AsyncRequestTimeoutException.class,org.springframework.web.ErrorResponseException.class,org.springframework.web.multipart.MaxUploadSizeExceededException.class,jakarta.servlet.ServletException.class}) protected final org.springframework.http.ResponseEntity<Object> handleException(Exception ex) These Exceptions all implementErrorResponseso they come pre-configured with a status-code and headers. -
handleExceptionLowLevel
@ExceptionHandler({org.springframework.beans.ConversionNotSupportedException.class,org.springframework.beans.TypeMismatchException.class,org.springframework.http.converter.HttpMessageNotReadableException.class,org.springframework.http.converter.HttpMessageNotWritableException.class,org.springframework.validation.method.MethodValidationException.class,org.springframework.validation.BindException.class}) protected final org.springframework.http.ResponseEntity<Object> handleExceptionLowLevel(Exception ex) Lower level bean-exceptions -
handleNoHandlerFoundException
@ExceptionHandler(org.springframework.web.servlet.NoHandlerFoundException.class) protected org.springframework.http.ResponseEntity<Object> handleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException ex) When aRestControllercannot be found, Spring MVC throws this Exception. -
handleSpringException
-