Class RouteDirectives

Direct Known Subclasses:
SchemeDirectives

public abstract class RouteDirectives extends RespondWithDirectives
  • Constructor Details

    • RouteDirectives

      public RouteDirectives()
  • Method Details

    • complete

      public Route complete(String body)
      Completes the request using an HTTP 200 OK status code and the given body as UTF-8 entity.
      Parameters:
      body - (undocumented)
      Returns:
      (undocumented)
    • complete

      public Route complete(HttpResponse response)
      Completes the request using the given http response.
      Parameters:
      response - (undocumented)
      Returns:
      (undocumented)
    • complete

      public Route complete(StatusCode status)
      Completes the request using the given status code.
      Parameters:
      status - (undocumented)
      Returns:
      (undocumented)
    • complete

      public <T> RouteAdapter complete(T value, Marshaller<T,HttpResponse> marshaller)
      Completes the request by marshalling the given value into an http response.
      Parameters:
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • complete

      public <T> RouteAdapter complete(StatusCode status, Iterable<HttpHeader> headers, T value, Marshaller<T,RequestEntity> marshaller)
      Completes the request using the given status code and headers, marshalling the given value as response entity.
      Parameters:
      status - (undocumented)
      headers - (undocumented)
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(StatusCode status, Iterable<HttpHeader> headers, ResponseEntity entity)
      Completes the request using the given status code, headers, and response entity.
      Parameters:
      status - (undocumented)
      headers - (undocumented)
      entity - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(StatusCode status, Iterable<HttpHeader> headers, RequestEntity entity)
      Completes the request using the given status code, headers, and response entity.
      Parameters:
      status - (undocumented)
      headers - (undocumented)
      entity - (undocumented)
      Returns:
      (undocumented)
    • complete

      public <T> RouteAdapter complete(StatusCode status, T value, Marshaller<T,RequestEntity> marshaller)
      Completes the request using the given status code, marshalling the given value as response entity.
      Parameters:
      status - (undocumented)
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(StatusCode status, ResponseEntity entity)
      Completes the request using the given status code and response entity.
      Parameters:
      status - (undocumented)
      entity - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(StatusCode status, RequestEntity entity)
      Completes the request using the given status code and response entity.
      Parameters:
      status - (undocumented)
      entity - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(StatusCode status, String entity)
      Completes the request using the given status code and the given body as UTF-8.
      Parameters:
      status - (undocumented)
      entity - (undocumented)
      Returns:
      (undocumented)
    • complete

      public <T> RouteAdapter complete(Iterable<HttpHeader> headers, T value, Marshaller<T,RequestEntity> marshaller)
      Completes the request as HTTP 200 OK, adding the given headers, and marshalling the given value as response entity.
      Parameters:
      headers - (undocumented)
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(Iterable<HttpHeader> headers, ResponseEntity entity)
      Completes the request as HTTP 200 OK, adding the given headers and response entity.
      Parameters:
      headers - (undocumented)
      entity - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(Iterable<HttpHeader> headers, RequestEntity entity)
      Completes the request as HTTP 200 OK, adding the given headers and response entity.
      Parameters:
      headers - (undocumented)
      entity - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(ResponseEntity entity)
      Completes the request as HTTP 200 OK with the given value as response entity.
      Parameters:
      entity - (undocumented)
      Returns:
      (undocumented)
    • complete

      public RouteAdapter complete(RequestEntity entity)
      Completes the request as HTTP 200 OK with the given value as response entity.
      Parameters:
      entity - (undocumented)
      Returns:
      (undocumented)
    • completeOK

      public <T> RouteAdapter completeOK(T value, Marshaller<T,RequestEntity> marshaller)
      Completes the request as HTTP 200 OK, marshalling the given value as response entity.
      Parameters:
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • completeOKWithFuture

      public <T> RouteAdapter completeOKWithFuture(scala.concurrent.Future<T> value, Marshaller<T,RequestEntity> marshaller)
      Completes the request by marshalling the given value into an http response.
      Parameters:
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • completeOKWithFuture

      public RouteAdapter completeOKWithFuture(CompletionStage<RequestEntity> value)
      Completes the request by marshalling the given future value into an http response.
      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • completeOKWithFuture

      public <T> RouteAdapter completeOKWithFuture(CompletionStage<T> value, Marshaller<T,RequestEntity> marshaller)
      Completes the request with an OK status code by marshalling the given value into an http response.
      Parameters:
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • completeOKWithFutureString

      public RouteAdapter completeOKWithFutureString(scala.concurrent.Future<String> value)
      Completes the request by marshalling the given future value into an http response.
      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • completeOKWithFutureString

      public RouteAdapter completeOKWithFutureString(CompletionStage<String> value)
      Completes the request by marshalling the given future value into an http response.
      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • completeWithFuture

      public <T> RouteAdapter completeWithFuture(scala.concurrent.Future<T> value, Marshaller<T,HttpResponse> marshaller)
      Completes the request by marshalling the given value into an http response.
      Parameters:
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • completeWithFuture

      public RouteAdapter completeWithFuture(CompletionStage<HttpResponse> value)
      Completes the request by marshalling the given future value into an http response.
      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • completeWithFuture

      public <T> RouteAdapter completeWithFuture(CompletionStage<T> value, Marshaller<T,HttpResponse> marshaller)
      Completes the request by marshalling the given value into an http response.
      Parameters:
      value - (undocumented)
      marshaller - (undocumented)
      Returns:
      (undocumented)
    • completeWithFutureResponse

      public RouteAdapter completeWithFutureResponse(scala.concurrent.Future<HttpResponse> value)
      Completes the request by marshalling the given future value into an http response.
      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • completeWithFutureStatus

      public Route completeWithFutureStatus(scala.concurrent.Future<StatusCode> status)
      Completes the request using the given future status code.
      Parameters:
      status - (undocumented)
      Returns:
      (undocumented)
    • completeWithFutureStatus

      public Route completeWithFutureStatus(CompletionStage<StatusCode> status)
      Completes the request using the given future status code.
      Parameters:
      status - (undocumented)
      Returns:
      (undocumented)
    • concat

      public Route concat(Route first, Route... alternatives)
      Used to chain multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).
      Parameters:
      first - (undocumented)
      alternatives - (undocumented)
      Returns:
      (undocumented)
    • concat

      public Route concat(Route first, scala.collection.immutable.Seq<Route> alternatives)
      Used to chain multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).
      Parameters:
      first - (undocumented)
      alternatives - (undocumented)
      Returns:
      (undocumented)
    • failWith

      public Route failWith(Throwable error)
      Bubbles the given error up the response chain, where it is dealt with by the closest handleExceptions directive and its ExceptionHandler.
      Parameters:
      error - (undocumented)
      Returns:
      (undocumented)
    • handle

      public Route handle(akka.japi.function.Function<HttpRequest,CompletionStage<HttpResponse>> handler)
      Handle the request using a function.
      Parameters:
      handler - (undocumented)
      Returns:
      (undocumented)
    • handleSync

      public Route handleSync(akka.japi.function.Function<HttpRequest,HttpResponse> handler)
      Handle the request using a function.
      Parameters:
      handler - (undocumented)
      Returns:
      (undocumented)
    • redirect

      public Route redirect(Uri uri, StatusCode redirectionType)
      Completes the request with redirection response of the given type to the given URI.

      Parameters:
      redirectionType - A status code from StatusCodes, which must be a redirection type.
      uri - (undocumented)
      Returns:
      (undocumented)
    • reject

      public Route reject(Rejection rejection, Rejection... rejections)
      Rejects the request with the given rejections, or with an empty set of rejections if no rejections are given.
      Parameters:
      rejection - (undocumented)
      rejections - (undocumented)
      Returns:
      (undocumented)
    • reject

      public Route reject(Rejection rejection, scala.collection.immutable.Seq<Rejection> rejections)
      Rejects the request with the given rejections, or with an empty set of rejections if no rejections are given.
      Parameters:
      rejection - (undocumented)
      rejections - (undocumented)
      Returns:
      (undocumented)
    • reject

      public Route reject()
      Rejects the request with an empty rejection (usually used for "no directive matched").
      Returns:
      (undocumented)
    • route

      public Route route(Route... alternatives)
      Deprecated.
      Use the RouteDirectives.concat method instead.
      Java-specific call added so you can chain together multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).
      Parameters:
      alternatives - (undocumented)
      Returns:
      (undocumented)
    • route

      public Route route(scala.collection.immutable.Seq<Route> alternatives)
      Deprecated.
      Use the RouteDirectives.concat method instead.
      Java-specific call added so you can chain together multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).
      Parameters:
      alternatives - (undocumented)
      Returns:
      (undocumented)