Class RejectionHandlerBuilder


  • public class RejectionHandlerBuilder
    extends java.lang.Object
    • Method Detail

      • handle

        public <T extends RejectionRejectionHandlerBuilder handle​(java.lang.Class<T> t,
                                                                    java.util.function.Function<T,​Route> handler)
        Handles a single Rejection with the given function.
        Parameters:
        t - (undocumented)
        handler - (undocumented)
        Returns:
        (undocumented)
      • handleAll

        public <T extends RejectionRejectionHandlerBuilder handleAll​(java.lang.Class<T> t,
                                                                       java.util.function.Function<java.util.List<T>,​Route> handler)
        Handles several Rejections of the same type at the same time. The list passed to the given function is guaranteed to be non-empty.
        Parameters:
        t - (undocumented)
        handler - (undocumented)
        Returns:
        (undocumented)
      • handleCircuitBreakerOpenRejection

        public RejectionHandlerBuilder handleCircuitBreakerOpenRejection​(java.util.function.Function<CircuitBreakerOpenRejection,​Route> handler)
        Convenience method for handling rejections created by created by the onCompleteWithBreaker directive. Signals that the request was rejected because the supplied circuit breaker is open and requests are failing fast.

        Use to customise the error response being written instead of the default akka.http.javadsl.model.StatusCodes.SERVICE_UNAVAILABLE response.

        Parameters:
        handler - (undocumented)
        Returns:
        (undocumented)
      • handleNotFound

        public RejectionHandlerBuilder handleNotFound​(Route route)
        Handles the special "not found" case using the given Route.
        Parameters:
        route - (undocumented)
        Returns:
        (undocumented)