public abstract class BasicDirectives
extends java.lang.Object
Constructor and Description |
---|
BasicDirectives() |
Modifier and Type | Method and Description |
---|---|
Route |
cancelRejection(Rejection rejection,
java.util.function.Supplier<Route> inner)
Adds a TransformationRejection cancelling all rejections equal to the given one
to the list of rejections potentially coming back from the inner route.
|
Route |
cancelRejections(java.lang.Iterable<java.lang.Class<?>> classes,
java.util.function.Supplier<Route> inner)
Adds a TransformationRejection cancelling all rejections of one of the given classes
to the list of rejections potentially coming back from the inner route.
|
Route |
cancelRejections(java.util.function.Predicate<Rejection> filter,
java.util.function.Supplier<Route> inner)
Adds a TransformationRejection cancelling all rejections for which the given filter function returns true
to the list of rejections potentially coming back from the inner route.
|
<T> Route |
extract(java.util.function.Function<RequestContext,T> extract,
java.util.function.Function<T,Route> inner)
Extracts a single value using the given function.
|
Route |
extractActorSystem(java.util.function.Function<org.apache.pekko.actor.ActorSystem,Route> inner)
Extracts the
pekko.actor.ActorSystem if the available Materializer is an pekko.stream.ActorMaterializer . |
RouteAdapter |
extractDataBytes(java.util.function.Function<org.apache.pekko.stream.javadsl.Source<org.apache.pekko.util.ByteString,java.lang.Object>,Route> inner)
Extracts the entities
dataBytes pekko.stream.javadsl.Source from the pekko.http.javadsl.server.RequestContext . |
Route |
extractEntity(java.util.function.Function<RequestEntity,Route> inner)
Extracts the current http request entity.
|
Route |
extractExecutionContext(java.util.function.Function<scala.concurrent.ExecutionContextExecutor,Route> inner)
Extracts the
ExecutionContextExecutor from the RequestContext . |
Route |
extractLog(java.util.function.Function<org.apache.pekko.event.LoggingAdapter,Route> inner)
Extracts the
LoggingAdapter |
RouteAdapter |
extractMatchedPath(java.util.function.Function<java.lang.String,Route> inner)
Extracts the already matched path from the RequestContext.
|
Route |
extractMaterializer(java.util.function.Function<org.apache.pekko.stream.Materializer,Route> inner)
Extracts the
Materializer from the RequestContext . |
RouteAdapter |
extractParserSettings(java.util.function.Function<ParserSettings,Route> inner)
Extracts the
pekko.http.javadsl.settings.ParserSettings from the pekko.http.javadsl.server.RequestContext . |
RouteAdapter |
extractRequest(java.util.function.Function<HttpRequest,Route> inner)
Extracts the current
HttpRequest instance. |
RouteAdapter |
extractRequestContext(java.util.function.Function<RequestContext,Route> inner)
Extracts the
pekko.http.javadsl.server.RequestContext itself. |
Route |
extractRequestEntity(java.util.function.Function<RequestEntity,Route> inner)
Extracts the
pekko.http.javadsl.model.RequestEntity from the pekko.http.javadsl.server.RequestContext . |
RouteAdapter |
extractSettings(java.util.function.Function<RoutingSettings,Route> inner)
Extracts the
RoutingSettings from the pekko.http.javadsl.server.RequestContext . |
Route |
extractStrictEntity(scala.concurrent.duration.FiniteDuration timeout,
java.util.function.Function<HttpEntity.Strict,Route> inner)
WARNING: This will read the entire request entity into memory and effectively disable streaming.
|
Route |
extractStrictEntity(scala.concurrent.duration.FiniteDuration timeout,
long maxBytes,
java.util.function.Function<HttpEntity.Strict,Route> inner)
WARNING: This will read the entire request entity into memory and effectively disable streaming.
|
RouteAdapter |
extractUnmatchedPath(java.util.function.Function<java.lang.String,Route> inner)
Extracts the yet unmatched path from the RequestContext.
|
RouteAdapter |
extractUri(java.util.function.Function<Uri,Route> inner)
Extracts the complete request URI.
|
Route |
mapInnerRoute(java.util.function.Function<Route,Route> f,
java.util.function.Supplier<Route> inner) |
Route |
mapRejections(java.util.function.Function<java.util.List<Rejection>,java.util.List<Rejection>> f,
java.util.function.Supplier<Route> inner) |
Route |
mapRequest(java.util.function.Function<HttpRequest,HttpRequest> f,
java.util.function.Supplier<Route> inner) |
Route |
mapRequestContext(java.util.function.Function<RequestContext,RequestContext> f,
java.util.function.Supplier<Route> inner) |
Route |
mapResponse(java.util.function.Function<HttpResponse,HttpResponse> f,
java.util.function.Supplier<Route> inner) |
Route |
mapResponseEntity(java.util.function.Function<ResponseEntity,ResponseEntity> f,
java.util.function.Supplier<Route> inner) |
Route |
mapResponseHeaders(java.util.function.Function<java.util.List<HttpHeader>,java.util.List<HttpHeader>> f,
java.util.function.Supplier<Route> inner) |
Route |
mapRouteResult(java.util.function.Function<RouteResult,RouteResult> f,
java.util.function.Supplier<Route> inner) |
Route |
mapRouteResultFuture(java.util.function.Function<java.util.concurrent.CompletionStage<RouteResult>,java.util.concurrent.CompletionStage<RouteResult>> f,
java.util.function.Supplier<Route> inner) |
Route |
mapRouteResultPF(scala.PartialFunction<RouteResult,RouteResult> f,
java.util.function.Supplier<Route> inner) |
Route |
mapRouteResultWith(java.util.function.Function<RouteResult,java.util.concurrent.CompletionStage<RouteResult>> f,
java.util.function.Supplier<Route> inner) |
Route |
mapRouteResultWithPF(scala.PartialFunction<RouteResult,java.util.concurrent.CompletionStage<RouteResult>> f,
java.util.function.Supplier<Route> inner) |
Route |
mapSettings(java.util.function.Function<RoutingSettings,RoutingSettings> f,
java.util.function.Supplier<Route> inner)
Runs the inner route with settings mapped by the given function.
|
Route |
mapUnmatchedPath(java.util.function.Function<java.lang.String,java.lang.String> f,
java.util.function.Supplier<Route> inner)
Transforms the unmatchedPath of the RequestContext using the given function.
|
Route |
pass(java.util.function.Supplier<Route> inner)
Always passes the request on to its inner route
(i.e. does nothing with the request or the response).
|
<T> Route |
provide(T t,
java.util.function.Function<T,Route> inner)
Injects the given value into a directive.
|
Route |
recoverRejections(java.util.function.Function<java.lang.Iterable<Rejection>,RouteResult> f,
java.util.function.Supplier<Route> inner) |
Route |
recoverRejectionsWith(java.util.function.Function<java.lang.Iterable<Rejection>,java.util.concurrent.CompletionStage<RouteResult>> f,
java.util.function.Supplier<Route> inner) |
Route |
toStrictEntity(scala.concurrent.duration.FiniteDuration timeout,
long maxBytes,
java.util.function.Supplier<Route> inner)
WARNING: This will read the entire request entity into memory and effectively disable streaming.
|
Route |
toStrictEntity(scala.concurrent.duration.FiniteDuration timeout,
java.util.function.Supplier<Route> inner)
WARNING: This will read the entire request entity into memory and effectively disable streaming.
|
Route |
withExecutionContext(scala.concurrent.ExecutionContextExecutor ec,
java.util.function.Supplier<Route> inner)
Runs its inner route with the given alternative
ExecutionContextExecutor . |
Route |
withLog(org.apache.pekko.event.LoggingAdapter log,
java.util.function.Supplier<Route> inner)
Runs its inner route with the given alternative
LoggingAdapter . |
Route |
withMaterializer(org.apache.pekko.stream.Materializer mat,
java.util.function.Supplier<Route> inner)
Runs its inner route with the given alternative
pekko.stream.Materializer . |
Route |
withSettings(RoutingSettings s,
java.util.function.Supplier<Route> inner)
Runs its inner route with the given alternative
RoutingSettings . |
public Route cancelRejection(Rejection rejection, java.util.function.Supplier<Route> inner)
rejection
- (undocumented)inner
- (undocumented)public Route cancelRejections(java.lang.Iterable<java.lang.Class<?>> classes, java.util.function.Supplier<Route> inner)
classes
- (undocumented)inner
- (undocumented)public Route cancelRejections(java.util.function.Predicate<Rejection> filter, java.util.function.Supplier<Route> inner)
filter
- (undocumented)inner
- (undocumented)public <T> Route extract(java.util.function.Function<RequestContext,T> extract, java.util.function.Function<T,Route> inner)
extract
- (undocumented)inner
- (undocumented)public Route extractActorSystem(java.util.function.Function<org.apache.pekko.actor.ActorSystem,Route> inner)
pekko.actor.ActorSystem
if the available Materializer is an pekko.stream.ActorMaterializer
.
Otherwise throws an exception as it won't be able to extract the system from arbitrary materializers.inner
- (undocumented)public RouteAdapter extractDataBytes(java.util.function.Function<org.apache.pekko.stream.javadsl.Source<org.apache.pekko.util.ByteString,java.lang.Object>,Route> inner)
dataBytes
pekko.stream.javadsl.Source
from the pekko.http.javadsl.server.RequestContext
.inner
- (undocumented)public Route extractEntity(java.util.function.Function<RequestEntity,Route> inner)
inner
- (undocumented)public Route extractExecutionContext(java.util.function.Function<scala.concurrent.ExecutionContextExecutor,Route> inner)
ExecutionContextExecutor
from the RequestContext
.inner
- (undocumented)public Route extractLog(java.util.function.Function<org.apache.pekko.event.LoggingAdapter,Route> inner)
LoggingAdapter
inner
- (undocumented)public RouteAdapter extractMatchedPath(java.util.function.Function<java.lang.String,Route> inner)
inner
- (undocumented)public Route extractMaterializer(java.util.function.Function<org.apache.pekko.stream.Materializer,Route> inner)
Materializer
from the RequestContext
.inner
- (undocumented)public RouteAdapter extractParserSettings(java.util.function.Function<ParserSettings,Route> inner)
pekko.http.javadsl.settings.ParserSettings
from the pekko.http.javadsl.server.RequestContext
.inner
- (undocumented)public RouteAdapter extractRequest(java.util.function.Function<HttpRequest,Route> inner)
HttpRequest
instance.inner
- (undocumented)public RouteAdapter extractRequestContext(java.util.function.Function<RequestContext,Route> inner)
pekko.http.javadsl.server.RequestContext
itself.inner
- (undocumented)public Route extractRequestEntity(java.util.function.Function<RequestEntity,Route> inner)
pekko.http.javadsl.model.RequestEntity
from the pekko.http.javadsl.server.RequestContext
.inner
- (undocumented)public RouteAdapter extractSettings(java.util.function.Function<RoutingSettings,Route> inner)
RoutingSettings
from the pekko.http.javadsl.server.RequestContext
.inner
- (undocumented)public Route extractStrictEntity(scala.concurrent.duration.FiniteDuration timeout, java.util.function.Function<HttpEntity.Strict,Route> inner)
To help protect against excessive memory use, the request will be aborted if the request is larger
than allowed by the pekko.http.parsing.max-to-strict-bytes
configuration setting.
Converts the HttpEntity from the pekko.http.javadsl.server.RequestContext
into an
pekko.http.javadsl.model.HttpEntity.Strict
and extracts it, or fails the route if unable to drain the
entire request body within the timeout.
timeout
- The directive is failed if the stream isn't completed after the given timeout.inner
- (undocumented)public Route extractStrictEntity(scala.concurrent.duration.FiniteDuration timeout, long maxBytes, java.util.function.Function<HttpEntity.Strict,Route> inner)
To help protect against excessive memory use, the request will be aborted if the request is larger
than allowed by the pekko.http.parsing.max-to-strict-bytes
configuration setting.
Converts the HttpEntity from the pekko.http.javadsl.server.RequestContext
into an
pekko.http.javadsl.model.HttpEntity.Strict
and extracts it, or fails the route if unable to drain the
entire request body within the timeout.
timeout
- The directive is failed if the stream isn't completed after the given timeout.maxBytes
- (undocumented)inner
- (undocumented)public RouteAdapter extractUnmatchedPath(java.util.function.Function<java.lang.String,Route> inner)
inner
- (undocumented)public RouteAdapter extractUri(java.util.function.Function<Uri,Route> inner)
inner
- (undocumented)public Route mapInnerRoute(java.util.function.Function<Route,Route> f, java.util.function.Supplier<Route> inner)
public Route mapRejections(java.util.function.Function<java.util.List<Rejection>,java.util.List<Rejection>> f, java.util.function.Supplier<Route> inner)
public Route mapRequest(java.util.function.Function<HttpRequest,HttpRequest> f, java.util.function.Supplier<Route> inner)
public Route mapRequestContext(java.util.function.Function<RequestContext,RequestContext> f, java.util.function.Supplier<Route> inner)
public Route mapResponse(java.util.function.Function<HttpResponse,HttpResponse> f, java.util.function.Supplier<Route> inner)
public Route mapResponseEntity(java.util.function.Function<ResponseEntity,ResponseEntity> f, java.util.function.Supplier<Route> inner)
public Route mapResponseHeaders(java.util.function.Function<java.util.List<HttpHeader>,java.util.List<HttpHeader>> f, java.util.function.Supplier<Route> inner)
public Route mapRouteResult(java.util.function.Function<RouteResult,RouteResult> f, java.util.function.Supplier<Route> inner)
public Route mapRouteResultFuture(java.util.function.Function<java.util.concurrent.CompletionStage<RouteResult>,java.util.concurrent.CompletionStage<RouteResult>> f, java.util.function.Supplier<Route> inner)
public Route mapRouteResultPF(scala.PartialFunction<RouteResult,RouteResult> f, java.util.function.Supplier<Route> inner)
public Route mapRouteResultWith(java.util.function.Function<RouteResult,java.util.concurrent.CompletionStage<RouteResult>> f, java.util.function.Supplier<Route> inner)
public Route mapRouteResultWithPF(scala.PartialFunction<RouteResult,java.util.concurrent.CompletionStage<RouteResult>> f, java.util.function.Supplier<Route> inner)
public Route mapSettings(java.util.function.Function<RoutingSettings,RoutingSettings> f, java.util.function.Supplier<Route> inner)
f
- (undocumented)inner
- (undocumented)public Route mapUnmatchedPath(java.util.function.Function<java.lang.String,java.lang.String> f, java.util.function.Supplier<Route> inner)
f
- (undocumented)inner
- (undocumented)public Route pass(java.util.function.Supplier<Route> inner)
inner
- (undocumented)public <T> Route provide(T t, java.util.function.Function<T,Route> inner)
t
- (undocumented)inner
- (undocumented)public Route recoverRejections(java.util.function.Function<java.lang.Iterable<Rejection>,RouteResult> f, java.util.function.Supplier<Route> inner)
public Route recoverRejectionsWith(java.util.function.Function<java.lang.Iterable<Rejection>,java.util.concurrent.CompletionStage<RouteResult>> f, java.util.function.Supplier<Route> inner)
public Route toStrictEntity(scala.concurrent.duration.FiniteDuration timeout, java.util.function.Supplier<Route> inner)
To help protect against excessive memory use, the request will be aborted if the request is larger
than allowed by the pekko.http.parsing.max-to-strict-bytes
configuration setting.
Extracts the pekko.http.javadsl.server.RequestContext
itself with the strict HTTP entity,
or fails the route if unable to drain the entire request body within the timeout.
timeout
- The directive is failed if the stream isn't completed after the given timeout.inner
- (undocumented)public Route toStrictEntity(scala.concurrent.duration.FiniteDuration timeout, long maxBytes, java.util.function.Supplier<Route> inner)
To help protect against excessive memory use, the request will be aborted if the request is larger
than allowed by the pekko.http.parsing.max-to-strict-bytes
configuration setting.
Extracts the pekko.http.javadsl.server.RequestContext
itself with the strict HTTP entity,
or fails the route if unable to drain the entire request body within the timeout.
timeout
- The directive is failed if the stream isn't completed after the given timeout.maxBytes
- (undocumented)inner
- (undocumented)public Route withExecutionContext(scala.concurrent.ExecutionContextExecutor ec, java.util.function.Supplier<Route> inner)
ExecutionContextExecutor
.ec
- (undocumented)inner
- (undocumented)public Route withLog(org.apache.pekko.event.LoggingAdapter log, java.util.function.Supplier<Route> inner)
LoggingAdapter
.log
- (undocumented)inner
- (undocumented)public Route withMaterializer(org.apache.pekko.stream.Materializer mat, java.util.function.Supplier<Route> inner)
pekko.stream.Materializer
.mat
- (undocumented)inner
- (undocumented)public Route withSettings(RoutingSettings s, java.util.function.Supplier<Route> inner)
RoutingSettings
.s
- (undocumented)inner
- (undocumented)