public abstract class Directive<L>
extends java.lang.Object
L
to create an inner route.Modifier and Type | Class and Description |
---|---|
static class |
Directive.Directive0Support
Adds helper functions to
Directive0 |
static class |
Directive.Directive0Support$ |
static class |
Directive.SingleValueModifiers<T> |
static class |
Directive.SingleValueTransformers<T>
"Standard" transformers for
Directive1 . |
static class |
Directive.SingleValueTransformers$ |
Modifier and Type | Method and Description |
---|---|
static scala.Function1<scala.Function0<scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>>,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> |
addByNameNullaryApply(Directive<scala.runtime.BoxedUnit> directive)
Adds
apply to Directive0. |
static <L> scala.Function1<java.lang.Object,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> |
addDirectiveApply(Directive<L> directive,
ApplyConverter<L> hac)
Adds
apply to all Directives with 1 or more extractions,
which allows specifying an n-ary function to receive the extractions instead of a Function1[TupleX, Route]. |
java.lang.Object |
and(ConjunctionMagnet<L> magnet)
Joins two directives into one which extracts the concatenation of its base directive extractions.
|
static <T> Directive<T> |
apply(scala.Function1<scala.Function1<T,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>>,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> f,
Tuple<T> evidence$4)
Constructs a directive from a function literal.
|
<A> Directive<scala.Tuple1<A>> |
as(ConstructFromTuple<L,A> constructor)
Converts this directive into one which, instead of a tuple of type
L , creates an
instance of type A (which is usually a case class). |
static Directive<scala.runtime.BoxedUnit> |
Empty()
A Directive that always passes the request on to its inner route (i.e. does nothing).
|
Tuple<L> |
ev() |
<R> Directive<R> |
or(Directive<R> that)
Joins two directives into one which runs the second directive if the first one rejects.
|
<R> Directive<R> |
recover(scala.Function1<scala.collection.immutable.Seq<Rejection>,Directive<R>> recovery,
Tuple<R> evidence$2)
Creates a new directive that is able to recover from rejections that were produced by
this Directive
**before the inner route was applied**. |
<R> Directive<R> |
recoverPF(scala.PartialFunction<scala.collection.immutable.Seq<Rejection>,Directive<R>> recovery,
Tuple<R> evidence$3)
Variant of
recover that only recovers from rejections handled by the given PartialFunction. |
static <T> Directive.SingleValueModifiers<T> |
SingleValueModifiers(Directive<scala.Tuple1<T>> underlying)
previous, non-value class implementation kept around for binary compatibility
TODO: remove with next binary incompatible release bump
INTERNAL API
|
abstract scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> |
tapply(scala.Function1<L,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> f)
Calls the inner route with a tuple of extracted values of type
L . |
<R> Directive<java.lang.Object> |
tcollect(scala.PartialFunction<L,R> pf,
scala.collection.immutable.Seq<Rejection> rejections,
Tupler<R> tupler)
If the given
PartialFunction is defined for the input, maps this directive with the given function,
which can produce either a tuple or any other value. |
Directive<L> |
tfilter(scala.Function1<L,java.lang.Object> predicate,
scala.collection.immutable.Seq<Rejection> rejections)
Creates a new directive of the same type, which passes if the given predicate matches the current
extractions or rejects with the given rejections.
|
<R> Directive<R> |
tflatMap(scala.Function1<L,Directive<R>> f,
Tuple<R> evidence$1)
Flatmaps this directive using the given function.
|
<R> Directive<java.lang.Object> |
tmap(scala.Function1<L,R> f,
Tupler<R> tupler)
Maps over this directive using the given function, which can produce either a tuple or any other value
(which will then we wrapped into a
Tuple1 ). |
Directive<scala.runtime.BoxedUnit> |
trequire(scala.Function1<L,java.lang.Object> predicate,
scala.collection.immutable.Seq<Rejection> rejections)
Creates a new
pekko.http.scaladsl.server.Directive0 , which passes if the given predicate matches the current
extractions or rejects with the given rejections. |
public static <T> Directive<T> apply(scala.Function1<scala.Function1<T,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>>,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> f, Tuple<T> evidence$4)
f
- (undocumented)evidence$4
- (undocumented)public static Directive<scala.runtime.BoxedUnit> Empty()
public static <L> scala.Function1<java.lang.Object,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> addDirectiveApply(Directive<L> directive, ApplyConverter<L> hac)
apply
to all Directives with 1 or more extractions,
which allows specifying an n-ary function to receive the extractions instead of a Function1[TupleX, Route].directive
- (undocumented)hac
- (undocumented)public static scala.Function1<scala.Function0<scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>>,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> addByNameNullaryApply(Directive<scala.runtime.BoxedUnit> directive)
apply
to Directive0. Note: The apply
parameter is call-by-name to ensure consistent execution behavior
with the directives producing extractions.directive
- (undocumented)public static <T> Directive.SingleValueModifiers<T> SingleValueModifiers(Directive<scala.Tuple1<T>> underlying)
INTERNAL API
underlying
- (undocumented)public abstract scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> tapply(scala.Function1<L,scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>>> f)
L
.
tapply
is short for "tuple-apply". Usually, you will use the regular apply
method instead,
which is added by an implicit conversion (see Directive.addDirectiveApply
).
f
- (undocumented)public <R> Directive<R> or(Directive<R> that)
that
- (undocumented)public java.lang.Object and(ConjunctionMagnet<L> magnet)
magnet
- (undocumented)public <A> Directive<scala.Tuple1<A>> as(ConstructFromTuple<L,A> constructor)
L
, creates an
instance of type A
(which is usually a case class).constructor
- (undocumented)public <R> Directive<java.lang.Object> tmap(scala.Function1<L,R> f, Tupler<R> tupler)
Tuple1
).f
- (undocumented)tupler
- (undocumented)public <R> Directive<R> tflatMap(scala.Function1<L,Directive<R>> f, Tuple<R> evidence$1)
f
- (undocumented)evidence$1
- (undocumented)public Directive<scala.runtime.BoxedUnit> trequire(scala.Function1<L,java.lang.Object> predicate, scala.collection.immutable.Seq<Rejection> rejections)
pekko.http.scaladsl.server.Directive0
, which passes if the given predicate matches the current
extractions or rejects with the given rejections.predicate
- (undocumented)rejections
- (undocumented)public Directive<L> tfilter(scala.Function1<L,java.lang.Object> predicate, scala.collection.immutable.Seq<Rejection> rejections)
predicate
- (undocumented)rejections
- (undocumented)public <R> Directive<java.lang.Object> tcollect(scala.PartialFunction<L,R> pf, scala.collection.immutable.Seq<Rejection> rejections, Tupler<R> tupler)
PartialFunction
is defined for the input, maps this directive with the given function,
which can produce either a tuple or any other value.
If it is not defined however, the returned directive will reject with the given rejections.pf
- (undocumented)rejections
- (undocumented)tupler
- (undocumented)public <R> Directive<R> recover(scala.Function1<scala.collection.immutable.Seq<Rejection>,Directive<R>> recovery, Tuple<R> evidence$2)
this
Directive
**before the inner route was applied**.recovery
- (undocumented)evidence$2
- (undocumented)public <R> Directive<R> recoverPF(scala.PartialFunction<scala.collection.immutable.Seq<Rejection>,Directive<R>> recovery, Tuple<R> evidence$3)
recover
that only recovers from rejections handled by the given PartialFunction.recovery
- (undocumented)evidence$3
- (undocumented)