Class ResponseEntityExceptionHandler

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.commons.logging.Log logger
      Common logger for use in subclasses.
      static String PAGE_NOT_FOUND_LOG_CATEGORY
      Log category to use when no mapped handler is found for a request.
      protected static org.apache.commons.logging.Log pageNotFoundLogger
      Specific logger to use when no mapped handler is found for a request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> createResponseEntity​(Object body, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.server.ServerWebExchange exchange)
      Create the ResponseEntity to use from the given body, headers, and statusCode.
      protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleBindException​(org.springframework.validation.BindException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.server.ServerWebExchange exchange)
      Customize the response for BindException.
      protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleConversionNotSupported​(org.springframework.beans.ConversionNotSupportedException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.server.ServerWebExchange exchange)
      Customize the response for ConversionNotSupportedException.
      reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleException​(Exception ex, org.springframework.web.server.ServerWebExchange exchange)
      Provides handling for standard Spring MVC exceptions.
      protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleExceptionInternal​(Exception ex, Object body, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.server.ServerWebExchange exchange)
      A single place to customize the response body of all exception types.
      protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleHttpMessageNotReadable​(org.springframework.http.converter.HttpMessageNotReadableException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.server.ServerWebExchange exchange)
      Customize the response for HttpMessageNotReadableException.
      protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleHttpMessageNotWritable​(org.springframework.http.converter.HttpMessageNotWritableException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.server.ServerWebExchange exchange)
      Customize the response for HttpMessageNotWritableException.
      protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleMethodArgumentNotValid​(org.springframework.web.bind.MethodArgumentNotValidException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.server.ServerWebExchange exchange)
      Customize the response for MethodArgumentNotValidException.
      protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleTypeMismatch​(org.springframework.beans.TypeMismatchException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.server.ServerWebExchange exchange)
      Customize the response for TypeMismatchException.
    • Field Detail

      • pageNotFoundLogger

        protected static final org.apache.commons.logging.Log pageNotFoundLogger
        Specific logger to use when no mapped handler is found for a request.
        See Also:
        PAGE_NOT_FOUND_LOG_CATEGORY
      • logger

        protected final org.apache.commons.logging.Log logger
        Common logger for use in subclasses.
    • Constructor Detail

      • ResponseEntityExceptionHandler

        public ResponseEntityExceptionHandler()
    • Method Detail

      • handleException

        @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.web.bind.MethodArgumentNotValidException.class,org.springframework.validation.BindException.class})
        @Nullable
        public final reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleException​(Exception ex,
                                                                                                                  org.springframework.web.server.ServerWebExchange exchange)
        Provides handling for standard Spring MVC exceptions.
        Parameters:
        ex - the target exception
        exchange - the current request and response
        Returns:
        a Mono with the ResponseEntity for the response
      • handleExceptionInternal

        protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> handleExceptionInternal​(Exception ex,
                                                                                                                       @Nullable
                                                                                                                       Object body,
                                                                                                                       org.springframework.http.HttpHeaders headers,
                                                                                                                       org.springframework.http.HttpStatus status,
                                                                                                                       org.springframework.web.server.ServerWebExchange exchange)
        A single place to customize the response body of all exception types.
        Parameters:
        ex - the exception
        body - the body for the response
        headers - the headers for the response
        status - the response status
        exchange - the current request and response
        Returns:
        a Mono with the ResponseEntity for the response
      • createResponseEntity

        protected reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Object>> createResponseEntity​(@Nullable
                                                                                                                    Object body,
                                                                                                                    org.springframework.http.HttpHeaders headers,
                                                                                                                    org.springframework.http.HttpStatus status,
                                                                                                                    org.springframework.web.server.ServerWebExchange exchange)
        Create the ResponseEntity to use from the given body, headers, and statusCode. Subclasses can override this method to inspect and possibly modify the body, headers, or statusCode, e.g. to re-create an instance of
        Parameters:
        body - the body to use for the response
        headers - the headers to use for the response
        status - the status code to use for the response
        exchange - the current request and response
        Returns:
        a Mono with the created ResponseEntity