Class RejectionHandlerBuilder

java.lang.Object
akka.http.javadsl.server.RejectionHandlerBuilder

public class RejectionHandlerBuilder extends Object
  • Constructor Details

  • Method Details

    • build

      public RejectionHandler build()
    • handle

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

      public <T extends Rejection> RejectionHandlerBuilder handleAll(Class<T> t, Function<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(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)