Class RejectionHandler.Builder

java.lang.Object
akka.http.scaladsl.server.RejectionHandler.Builder
Enclosing interface:
RejectionHandler

public static final class RejectionHandler.Builder extends Object
  • Constructor Details

    • Builder

      public Builder(boolean isDefault)
  • Method Details

    • handle

      public RejectionHandler.Builder handle(scala.PartialFunction<Rejection,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> pf)
      Handles a single Rejection with the given partial function.
      Parameters:
      pf - (undocumented)
      Returns:
      (undocumented)
    • handleAll

      public <T extends Rejection> RejectionHandler.Builder handleAll(scala.Function1<scala.collection.immutable.Seq<T>,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> f, scala.reflect.ClassTag<T> evidence$1)
      Handles several Rejections of the same type at the same time. The seq passed to the given function is guaranteed to be non-empty.
      Parameters:
      f - (undocumented)
      evidence$1 - (undocumented)
      Returns:
      (undocumented)
    • handleCircuitBreakerOpenRejection

      public RejectionHandler.Builder handleCircuitBreakerOpenRejection(scala.Function1<CircuitBreakerOpenRejection,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> handler)
      Convenience method for handling rejections 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 ServiceUnavailable response.

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

      public RejectionHandler.Builder handleNotFound(scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> route)
      Handles the special "not found" case using the given Route.
      Parameters:
      route - (undocumented)
      Returns:
      (undocumented)
    • result

      public RejectionHandler result()