Class ApiExceptionHandler

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean, org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler, org.springframework.web.server.WebExceptionHandler

    @Validated
    public class ApiExceptionHandler
    extends org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler
    The reactive api exception handler.
    Author:
    Christian Bremer
    • Constructor Summary

      Constructors 
      Constructor Description
      ApiExceptionHandler​(@NotNull org.springframework.boot.web.reactive.error.ErrorAttributes errorAttributes, org.springframework.boot.autoconfigure.web.WebProperties.Resources resources, @NotNull org.springframework.context.ApplicationContext applicationContext, org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer, @NotNull org.bremersee.exception.RestApiExceptionMapper restApiExceptionMapper)
      Instantiates a new api exception handler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.springframework.web.reactive.function.server.RouterFunction<org.springframework.web.reactive.function.server.ServerResponse> getRoutingFunction​(org.springframework.boot.web.reactive.error.ErrorAttributes errorAttributes)  
      protected boolean isResponsibleExceptionHandler​(org.springframework.web.reactive.function.server.ServerRequest request)
      Is this exception handler responsible.
      protected reactor.core.publisher.Mono<org.springframework.web.reactive.function.server.ServerResponse> renderErrorResponse​(org.springframework.web.reactive.function.server.ServerRequest request)
      Render error response.
      • Methods inherited from class org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler

        afterPropertiesSet, getError, getErrorAttributes, getErrorAttributes, handle, isBindingErrorsEnabled, isMessageEnabled, isTraceEnabled, logError, renderDefaultErrorView, renderErrorView, setMessageReaders, setMessageWriters, setViewResolvers
    • Constructor Detail

      • ApiExceptionHandler

        public ApiExceptionHandler​(@NotNull
                                   @NotNull org.springframework.boot.web.reactive.error.ErrorAttributes errorAttributes,
                                   @NotNull
                                   org.springframework.boot.autoconfigure.web.WebProperties.Resources resources,
                                   @NotNull
                                   @NotNull org.springframework.context.ApplicationContext applicationContext,
                                   @Nullable
                                   org.springframework.http.codec.ServerCodecConfigurer serverCodecConfigurer,
                                   @NotNull
                                   @NotNull org.bremersee.exception.RestApiExceptionMapper restApiExceptionMapper)
        Instantiates a new api exception handler.
        Parameters:
        errorAttributes - the error attributes
        resources - the resources
        applicationContext - the application context
        serverCodecConfigurer - the server codec configurer
        restApiExceptionMapper - the rest api exception mapper
    • Method Detail

      • getRoutingFunction

        protected org.springframework.web.reactive.function.server.RouterFunction<org.springframework.web.reactive.function.server.ServerResponse> getRoutingFunction​(org.springframework.boot.web.reactive.error.ErrorAttributes errorAttributes)
        Specified by:
        getRoutingFunction in class org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler
      • isResponsibleExceptionHandler

        protected boolean isResponsibleExceptionHandler​(org.springframework.web.reactive.function.server.ServerRequest request)
        Is this exception handler responsible.
        Parameters:
        request - the request
        Returns:
        true if it is responsible, otherwise false
      • renderErrorResponse

        @NonNull
        protected reactor.core.publisher.Mono<org.springframework.web.reactive.function.server.ServerResponse> renderErrorResponse​(org.springframework.web.reactive.function.server.ServerRequest request)
        Render error response.
        Parameters:
        request - the request
        Returns:
        the server response