Class RouteAdapter

  • All Implemented Interfaces:
    HandlerProvider, Route

    public final class RouteAdapter
    extends java.lang.Object
    implements Route
    INTERNAL API
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static RouteAdapter apply​(scala.Function1<RequestContext,​scala.concurrent.Future<RouteResult>> delegate)  
      static Route asJava​(scala.Function1<RequestContext,​scala.concurrent.Future<RouteResult>> delegate)
      Java DSL: Adapt an existing ScalaDSL Route as an Java DSL Route
      scala.Function1<RequestContext,​scala.concurrent.Future<RouteResult>> delegate()
      INTERNAL API
      akka.stream.javadsl.Flow<HttpRequest,​HttpResponse,​akka.NotUsed> flow​(akka.actor.ActorSystem system, akka.stream.Materializer materializer)  
      akka.japi.function.Function<HttpRequest,​java.util.concurrent.CompletionStage<HttpResponse>> handler​(akka.actor.ClassicActorSystemProvider system)  
      akka.japi.function.Function<HttpRequest,​java.util.concurrent.CompletionStage<HttpResponse>> handler​(akka.actor.ClassicActorSystemProvider system, scala.concurrent.ExecutionContextExecutor executionContext, akka.stream.Materializer materializer)
      Like handler(system), but allows overriding the ExecutionContext and Materializer used to complete requests, instead of defaulting to system.dispatcher() and the SystemMaterializer.
      Route orElse​(Route alternative)  
      Route seal()
      Seals a route by wrapping it with default exception handling and rejection conversion.
      Route seal​(RejectionHandler rejectionHandler, ExceptionHandler exceptionHandler)
      Seals a route by wrapping it with explicit exception handling and rejection conversion.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • asJava

        public static Route asJava​(scala.Function1<RequestContext,​scala.concurrent.Future<RouteResult>> delegate)
        Java DSL: Adapt an existing ScalaDSL Route as an Java DSL Route
      • flow

        public akka.stream.javadsl.Flow<HttpRequest,​HttpResponse,​akka.NotUsed> flow​(akka.actor.ActorSystem system,
                                                                                                akka.stream.Materializer materializer)
        Specified by:
        flow in interface Route
      • handler

        public akka.japi.function.Function<HttpRequest,​java.util.concurrent.CompletionStage<HttpResponse>> handler​(akka.actor.ClassicActorSystemProvider system,
                                                                                                                         scala.concurrent.ExecutionContextExecutor executionContext,
                                                                                                                         akka.stream.Materializer materializer)
        Description copied from interface: Route
        Like handler(system), but allows overriding the ExecutionContext and Materializer used to complete requests, instead of defaulting to system.dispatcher() and the SystemMaterializer. Pass null for either parameter to keep its default.
        Specified by:
        handler in interface Route
        Parameters:
        system - (undocumented)
        executionContext - (undocumented)
        materializer - (undocumented)
        Returns:
        (undocumented)
      • seal

        public Route seal()
        Description copied from interface: Route
        Seals a route by wrapping it with default exception handling and rejection conversion.

        A sealed route has these properties: - The result of the route will always be a complete response, i.e. the result of the future is a Success(RouteResult.Complete(response)), never a failed future and never a rejected route. These will be already be handled using the default RejectionHandler and ExceptionHandler. - Consequently, no route alternatives will be tried that were combined with this route.

        Specified by:
        seal in interface Route
        Returns:
        (undocumented)
      • seal

        public Route seal​(RejectionHandler rejectionHandler,
                          ExceptionHandler exceptionHandler)
        Description copied from interface: Route
        Seals a route by wrapping it with explicit exception handling and rejection conversion.

        A sealed route has these properties: - The result of the route will always be a complete response, i.e. the result of the future is a Success(RouteResult.Complete(response)), never a failed future and never a rejected route. These will be already be handled using the given RejectionHandler and ExceptionHandler. - Consequently, no route alternatives will be tried that were combined with this route.

        Specified by:
        seal in interface Route
        Parameters:
        rejectionHandler - (undocumented)
        exceptionHandler - (undocumented)
        Returns:
        (undocumented)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object