Class Directives$

java.lang.Object
akka.http.javadsl.server.directives.BasicDirectives

public class Directives$ extends AllDirectives
Collects all default directives into one class for simple importing of static functions.

See Directives for ScalaDSL equivalent of this class.

  • Field Details

    • MODULE$

      public static final Directives$ MODULE$
      Static reference to the singleton instance of this Scala object.
  • Constructor Details

    • Directives$

      public Directives$()
  • Method Details

    • route

      public Route route(Route... alternatives)
      Overrides:
      route in class FramedEntityStreamingDirectives
    • getFromBrowseableDirectories

      public Route getFromBrowseableDirectories(String... directories)
      Overrides:
      getFromBrowseableDirectories in class FramedEntityStreamingDirectives
    • route

      public Route route(scala.collection.immutable.Seq<Route> alternatives)
      Overrides:
      route in class FramedEntityStreamingDirectives
    • getFromBrowseableDirectories

      public Route getFromBrowseableDirectories(scala.collection.immutable.Seq<String> directories)
      Overrides:
      getFromBrowseableDirectories in class FramedEntityStreamingDirectives
    • anyOf

      public Route anyOf(Function<Supplier<Route>,Route> first, Function<Supplier<Route>,Route> second, Supplier<Route> inner)
      Composes two 0-argument directives which share the same inner Route. This is equivalent to first(inner).orElse(second(inner)) Usage example: anyOf(this::get, this::post, () -> complete("hi")))
      Parameters:
      first - the first 0-argument directive
      second - the second 0-argument directive
      inner - the inner route Producer
      Returns:
      the resulting route
    • anyOf

      public <A> Route anyOf(Function<Function<A,Route>,Route> first, Function<Function<A,Route>,Route> second, Function<A,Route> inner)
      Composes two 1-argument directives (directives whose inner route takes a parameter) which share the same inner route. This is the same as first(inner).orElse(second(inner)). This can be used also for directives that take an additional parameter if the directive is partially applied, ie. parameter Usage example: anyOf(bindParameter(this::path, "bar"), bindParameter(this::path, "baz"), () -> complete("bar or baz"))
      Parameters:
      first - the first 1-argument directive
      second - the second 1-argument directive
      inner - the inner route that takes one argument
      Returns:
      the resulting route
    • allOf

      public Route allOf(Function<Supplier<Route>,Route> first, Function<Supplier<Route>,Route> second, Supplier<Route> inner)
      Nests two 0-argument directives together Usage example: allOf(bindParameter(this::pathPrefix, "alice"), bindParameter(this::path, "bob"), () -> complete("Charlie!"))
      Parameters:
      first - the 0-argument directive (outer one)
      second - the 0-argument directive (inner one)
      inner - the inner route function
      Returns:
      the resulting route
    • allOf

      public <A, B> Route allOf(Function<Function<A,Route>,Route> first, Function<Function<B,Route>,Route> second, BiFunction<A,B,Route> inner)
      Nests two 1-argument directives together Usage example: allOf(this::extractScheme, this::extractMethod, (scheme, method) -> complete("You did a " + method.name() + " using " + scheme))
      Parameters:
      first - the first 1-argument directive (outer one)
      second - the second 1-argument directive (inner one)
      inner - the inner route function that takes 2 different parameters
      Returns:
      the resulting route
    • allOf

      public <A> Route allOf(Function<Supplier<Route>,Route> first, Function<Function<A,Route>,Route> second, Function<A,Route> inner)
      Nests one 0-argument and 1-argument directives together Usage example: allOf(bindParameter(this::pathPrefix, "guess"), this::extractMethod, method -> complete("You did a " + method.name()))
      Parameters:
      first - the 0-argument directive (outer one)
      second - the 1-argument directive (inner one)
      inner - the inner route function that takes 1 parameter
      Returns:
      the resulting route