Interface BasicDirectives
- All Known Subinterfaces:
Directives
- All Known Implementing Classes:
BasicDirectives$
,Directives$
,HttpApp
-
Method Summary
Modifier and TypeMethodDescriptionDirective<scala.runtime.BoxedUnit>
cancelRejection
(Rejection rejection) Adds a TransformationRejection cancelling all rejections equal to the given one to the list of rejections potentially coming back from the inner route.Directive<scala.runtime.BoxedUnit>
cancelRejections
(scala.collection.immutable.Seq<Class<?>> classes) Adds a TransformationRejection cancelling all rejections of one of the given classes to the list of rejections potentially coming back from the inner route.Directive<scala.runtime.BoxedUnit>
cancelRejections
(scala.Function1<Rejection, Object> cancelFilter) 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> Directive<scala.Tuple1<T>>
extract
(scala.Function1<RequestContext, T> f) Extracts a single value using the given function.Directive<scala.Tuple1<org.apache.pekko.actor.ActorSystem>>
Extracts thepekko.actor.ActorSystem
if the Materializer is available.Directive<scala.Tuple1<org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,
Object>>> Extracts the entitiesdataBytes
pekko.stream.scaladsl.Source
from thepekko.http.scaladsl.server.RequestContext
.Directive<scala.Tuple1<scala.concurrent.ExecutionContextExecutor>>
Extracts theExecutionContextExecutor
from thepekko.http.scaladsl.server.RequestContext
.Directive<scala.Tuple1<org.apache.pekko.event.LoggingAdapter>>
Extracts thepekko.event.LoggingAdapter
from thepekko.http.scaladsl.server.RequestContext
.Extracts the already matched path from the RequestContext.Directive<scala.Tuple1<org.apache.pekko.stream.Materializer>>
Extracts thepekko.stream.Materializer
from thepekko.http.scaladsl.server.RequestContext
.Directive<scala.Tuple1<ParserSettings>>
Extracts thepekko.http.scaladsl.settings.ParserSettings
from thepekko.http.scaladsl.server.RequestContext
.Directive<scala.Tuple1<HttpRequest>>
Extracts the currentHttpRequest
instance.Directive<scala.Tuple1<RequestContext>>
Extracts thepekko.http.scaladsl.server.RequestContext
itself.Directive<scala.Tuple1<RequestEntity>>
Extracts thepekko.http.scaladsl.model.RequestEntity
from thepekko.http.scaladsl.server.RequestContext
.Directive<scala.Tuple1<RoutingSettings>>
Extracts theRoutingSettings
from thepekko.http.scaladsl.server.RequestContext
.Directive<scala.Tuple1<HttpEntity.Strict>>
extractStrictEntity
(scala.concurrent.duration.FiniteDuration timeout) WARNING: This will read the entire request entity into memory and effectively disable streaming.Directive<scala.Tuple1<HttpEntity.Strict>>
extractStrictEntity
(scala.concurrent.duration.FiniteDuration timeout, long maxBytes) WARNING: This will read the entire request entity into memory and effectively disable streaming.Extracts the yet unmatched path from the RequestContext.Extracts the complete request URI.Directive<scala.runtime.BoxedUnit>
mapInnerRoute
(scala.Function1<scala.Function1<RequestContext, scala.concurrent.Future<RouteResult>>, scala.Function1<RequestContext, scala.concurrent.Future<RouteResult>>> f) Directive<scala.runtime.BoxedUnit>
mapRejections
(scala.Function1<scala.collection.immutable.Seq<Rejection>, scala.collection.immutable.Seq<Rejection>> f) Directive<scala.runtime.BoxedUnit>
mapRequest
(scala.Function1<HttpRequest, HttpRequest> f) Directive<scala.runtime.BoxedUnit>
mapRequestContext
(scala.Function1<RequestContext, RequestContext> f) Directive<scala.runtime.BoxedUnit>
mapResponse
(scala.Function1<HttpResponse, HttpResponse> f) Directive<scala.runtime.BoxedUnit>
mapResponseEntity
(scala.Function1<ResponseEntity, ResponseEntity> f) Directive<scala.runtime.BoxedUnit>
mapResponseHeaders
(scala.Function1<scala.collection.immutable.Seq<HttpHeader>, scala.collection.immutable.Seq<HttpHeader>> f) Directive<scala.runtime.BoxedUnit>
mapRouteResult
(scala.Function1<RouteResult, RouteResult> f) Directive<scala.runtime.BoxedUnit>
mapRouteResultFuture
(scala.Function1<scala.concurrent.Future<RouteResult>, scala.concurrent.Future<RouteResult>> f) Directive<scala.runtime.BoxedUnit>
mapRouteResultPF
(scala.PartialFunction<RouteResult, RouteResult> f) Directive<scala.runtime.BoxedUnit>
mapRouteResultWith
(scala.Function1<RouteResult, scala.concurrent.Future<RouteResult>> f) Directive<scala.runtime.BoxedUnit>
mapRouteResultWithPF
(scala.PartialFunction<RouteResult, scala.concurrent.Future<RouteResult>> f) Directive<scala.runtime.BoxedUnit>
mapSettings
(scala.Function1<RoutingSettings, RoutingSettings> f) Runs the inner route with settings mapped by the given function.Directive<scala.runtime.BoxedUnit>
mapUnmatchedPath
(scala.Function1<Uri.Path, Uri.Path> f) Transforms the unmatchedPath of the RequestContext using the given function.Directive<scala.runtime.BoxedUnit>
pass()
A Directive0 that always passes the request on to its inner route (i.e. does nothing with the request or the response).<T> Directive<scala.Tuple1<T>>
provide
(T value) Injects the given value into a directive.Directive<scala.runtime.BoxedUnit>
recoverRejections
(scala.Function1<scala.collection.immutable.Seq<Rejection>, RouteResult> f) Directive<scala.runtime.BoxedUnit>
recoverRejectionsWith
(scala.Function1<scala.collection.immutable.Seq<Rejection>, scala.concurrent.Future<RouteResult>> f) <L> Directive<L>
textract
(scala.Function1<RequestContext, L> f, Tuple<L> evidence$2) Extracts a number of values using the given function.Directive<scala.runtime.BoxedUnit>
toStrictEntity
(scala.concurrent.duration.FiniteDuration timeout) WARNING: This will read the entire request entity into memory and effectively disable streaming.Directive<scala.runtime.BoxedUnit>
toStrictEntity
(scala.concurrent.duration.FiniteDuration timeout, long maxBytes) WARNING: This will read the entire request entity into memory and effectively disable streaming.<L> Directive<L>
Injects the given values into a directive.Directive<scala.runtime.BoxedUnit>
withExecutionContext
(scala.concurrent.ExecutionContextExecutor ec) Runs its inner route with the given alternativeExecutionContextExecutor
.Directive<scala.runtime.BoxedUnit>
withLog
(org.apache.pekko.event.LoggingAdapter log) Runs its inner route with the given alternativepekko.event.LoggingAdapter
.Directive<scala.runtime.BoxedUnit>
withMaterializer
(org.apache.pekko.stream.Materializer materializer) Runs its inner route with the given alternativepekko.stream.Materializer
.Directive<scala.runtime.BoxedUnit>
withSettings
(RoutingSettings settings) Runs its inner route with the given alternativeRoutingSettings
.
-
Method Details
-
mapInnerRoute
Directive<scala.runtime.BoxedUnit> mapInnerRoute(scala.Function1<scala.Function1<RequestContext, scala.concurrent.Future<RouteResult>>, scala.Function1<RequestContext, scala.concurrent.Future<RouteResult>>> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapRequestContext
Directive<scala.runtime.BoxedUnit> mapRequestContext(scala.Function1<RequestContext, RequestContext> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapRequest
- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapRouteResultFuture
Directive<scala.runtime.BoxedUnit> mapRouteResultFuture(scala.Function1<scala.concurrent.Future<RouteResult>, scala.concurrent.Future<RouteResult>> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapRouteResult
- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapRouteResultWith
Directive<scala.runtime.BoxedUnit> mapRouteResultWith(scala.Function1<RouteResult, scala.concurrent.Future<RouteResult>> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapRouteResultPF
Directive<scala.runtime.BoxedUnit> mapRouteResultPF(scala.PartialFunction<RouteResult, RouteResult> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapRouteResultWithPF
Directive<scala.runtime.BoxedUnit> mapRouteResultWithPF(scala.PartialFunction<RouteResult, scala.concurrent.Future<RouteResult>> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
recoverRejections
Directive<scala.runtime.BoxedUnit> recoverRejections(scala.Function1<scala.collection.immutable.Seq<Rejection>, RouteResult> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
recoverRejectionsWith
Directive<scala.runtime.BoxedUnit> recoverRejectionsWith(scala.Function1<scala.collection.immutable.Seq<Rejection>, scala.concurrent.Future<RouteResult>> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapRejections
Directive<scala.runtime.BoxedUnit> mapRejections(scala.Function1<scala.collection.immutable.Seq<Rejection>, scala.collection.immutable.Seq<Rejection>> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapResponse
- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapResponseEntity
Directive<scala.runtime.BoxedUnit> mapResponseEntity(scala.Function1<ResponseEntity, ResponseEntity> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
mapResponseHeaders
Directive<scala.runtime.BoxedUnit> mapResponseHeaders(scala.Function1<scala.collection.immutable.Seq<HttpHeader>, scala.collection.immutable.Seq<HttpHeader>> f) - Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
pass
Directive<scala.runtime.BoxedUnit> pass()A Directive0 that always passes the request on to its inner route (i.e. does nothing with the request or the response).- Returns:
- (undocumented)
-
provide
Injects the given value into a directive.- Parameters:
value
- (undocumented)- Returns:
- (undocumented)
-
tprovide
Injects the given values into a directive.- Parameters:
values
- (undocumented)evidence$1
- (undocumented)- Returns:
- (undocumented)
-
extract
Extracts a single value using the given function.- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
textract
Extracts a number of values using the given function.- Parameters:
f
- (undocumented)evidence$2
- (undocumented)- Returns:
- (undocumented)
-
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)- Returns:
- (undocumented)
-
cancelRejections
Directive<scala.runtime.BoxedUnit> cancelRejections(scala.collection.immutable.Seq<Class<?>> classes) 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)- 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:
cancelFilter
- (undocumented)- Returns:
- (undocumented)
-
mapUnmatchedPath
Transforms the unmatchedPath of the RequestContext using the given function.- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
extractUnmatchedPath
Extracts the yet unmatched path from the RequestContext.- Returns:
- (undocumented)
-
extractMatchedPath
Extracts the already matched path from the RequestContext.- Returns:
- (undocumented)
-
extractRequest
Directive<scala.Tuple1<HttpRequest>> extractRequest()Extracts the currentHttpRequest
instance.- Returns:
- (undocumented)
-
extractUri
Extracts the complete request URI.- Returns:
- (undocumented)
-
withExecutionContext
Directive<scala.runtime.BoxedUnit> withExecutionContext(scala.concurrent.ExecutionContextExecutor ec) Runs its inner route with the given alternativeExecutionContextExecutor
.- Parameters:
ec
- (undocumented)- Returns:
- (undocumented)
-
extractExecutionContext
Directive<scala.Tuple1<scala.concurrent.ExecutionContextExecutor>> extractExecutionContext()Extracts theExecutionContextExecutor
from thepekko.http.scaladsl.server.RequestContext
.- Returns:
- (undocumented)
-
withMaterializer
Directive<scala.runtime.BoxedUnit> withMaterializer(org.apache.pekko.stream.Materializer materializer) Runs its inner route with the given alternativepekko.stream.Materializer
.- Parameters:
materializer
- (undocumented)- Returns:
- (undocumented)
-
extractMaterializer
Directive<scala.Tuple1<org.apache.pekko.stream.Materializer>> extractMaterializer()Extracts thepekko.stream.Materializer
from thepekko.http.scaladsl.server.RequestContext
.- Returns:
- (undocumented)
-
extractActorSystem
Directive<scala.Tuple1<org.apache.pekko.actor.ActorSystem>> extractActorSystem()Extracts thepekko.actor.ActorSystem
if the Materializer is available. Otherwise throws an exception as it won't be able to extract the system from arbitrary materializers.- Returns:
- (undocumented)
-
withLog
Runs its inner route with the given alternativepekko.event.LoggingAdapter
.- Parameters:
log
- (undocumented)- Returns:
- (undocumented)
-
extractLog
Directive<scala.Tuple1<org.apache.pekko.event.LoggingAdapter>> extractLog()Extracts thepekko.event.LoggingAdapter
from thepekko.http.scaladsl.server.RequestContext
.- Returns:
- (undocumented)
-
withSettings
Runs its inner route with the given alternativeRoutingSettings
.- Parameters:
settings
- (undocumented)- Returns:
- (undocumented)
-
mapSettings
Runs the inner route with settings mapped by the given function.- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
extractSettings
Directive<scala.Tuple1<RoutingSettings>> extractSettings()Extracts theRoutingSettings
from thepekko.http.scaladsl.server.RequestContext
.- Returns:
- (undocumented)
-
extractParserSettings
Directive<scala.Tuple1<ParserSettings>> extractParserSettings()Extracts thepekko.http.scaladsl.settings.ParserSettings
from thepekko.http.scaladsl.server.RequestContext
.- Returns:
- (undocumented)
-
extractRequestContext
Directive<scala.Tuple1<RequestContext>> extractRequestContext()Extracts thepekko.http.scaladsl.server.RequestContext
itself.- Returns:
- (undocumented)
-
extractRequestEntity
Directive<scala.Tuple1<RequestEntity>> extractRequestEntity()Extracts thepekko.http.scaladsl.model.RequestEntity
from thepekko.http.scaladsl.server.RequestContext
.- Returns:
- (undocumented)
-
extractDataBytes
Directive<scala.Tuple1<org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,Object>>> extractDataBytes()Extracts the entitiesdataBytes
pekko.stream.scaladsl.Source
from thepekko.http.scaladsl.server.RequestContext
.- Returns:
- (undocumented)
-
extractStrictEntity
Directive<scala.Tuple1<HttpEntity.Strict>> extractStrictEntity(scala.concurrent.duration.FiniteDuration timeout) 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
pekko.http.parsing.max-to-strict-bytes
configuration setting.Converts the HttpEntity from the
pekko.http.scaladsl.server.RequestContext
into anpekko.http.scaladsl.model.HttpEntity.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.- Returns:
- (undocumented)
-
extractStrictEntity
Directive<scala.Tuple1<HttpEntity.Strict>> extractStrictEntity(scala.concurrent.duration.FiniteDuration timeout, long maxBytes) 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
pekko.http.parsing.max-to-strict-bytes
configuration setting.Converts the HttpEntity from the
pekko.http.scaladsl.server.RequestContext
into anpekko.http.scaladsl.model.HttpEntity.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)- Returns:
- (undocumented)
-
toStrictEntity
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
pekko.http.parsing.max-to-strict-bytes
configuration setting.Extracts the
pekko.http.scaladsl.server.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.- Returns:
- (undocumented)
-
toStrictEntity
Directive<scala.runtime.BoxedUnit> toStrictEntity(scala.concurrent.duration.FiniteDuration timeout, long maxBytes) 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
pekko.http.parsing.max-to-strict-bytes
configuration setting.Extracts the
pekko.http.scaladsl.server.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)- Returns:
- (undocumented)
-