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