Predefined Directives (alphabetically)

Predefined Directives (alphabetically)

Directive Description
authenticateBasic Wraps the inner route with Http Basic authentication support using a given Authenticator<T>
authenticateBasicAsync Wraps the inner route with Http Basic authentication support using a given AsyncAuthenticator<T>
authenticateBasicPF Wraps the inner route with Http Basic authentication support using a given AuthenticatorPF<T>
authenticateBasicPFAsync Wraps the inner route with Http Basic authentication support using a given AsyncAuthenticatorPF<T>
authenticateOAuth2 Wraps the inner route with OAuth Bearer Token authentication support using a given AuthenticatorPF<T>
authenticateOAuth2Async Wraps the inner route with OAuth Bearer Token authentication support using a given AsyncAuthenticator<T>
authenticateOAuth2PF Wraps the inner route with OAuth Bearer Token authentication support using a given AuthenticatorPF<T>
authenticateOAuth2PFAsync Wraps the inner route with OAuth Bearer Token authentication support using a given AsyncAuthenticatorPF<T>
authenticateOrRejectWithChallenge Lifts an authenticator function into a directive
authorize Applies the given authorization check to the request
authorizeAsync Applies the given asynchronous authorization check to the request
cancelRejection Adds a TransformationRejection cancelling all rejections equal to the given one to the rejections potentially coming back from the inner route.
cancelRejections Adds a TransformationRejection cancelling all matching rejections to the rejections potentially coming back from the inner route
checkSameOrigin Checks that the request comes from the same origin
complete Completes the request using the given arguments
completeOrRecoverWith "Unwraps" a CompletionStage<T> and runs the inner route when the future has failed with the error as an extraction of type Throwable
completeWith Uses the marshaller for a given type to extract a completion function
conditional Wraps its inner route with support for conditional requests as defined by http://tools.ietf.org/html/rfc7232
cookie Extracts the HttpCookie with the given name
decodeRequest Decompresses the request if it is gzip or deflate compressed
decodeRequestWith Decodes the incoming request using one of the given decoders
delete Rejects all non-DELETE requests
deleteCookie Adds a Set-Cookie response header expiring the given cookies
encodeResponse Encodes the response with the encoding that is requested by the client via the Accept-Encoding header (NoCoding, Gzip and Deflate)
encodeResponseWith Encodes the response with the encoding that is requested by the client via the Accept-Encoding header (from a user-defined set)
entity Extracts the request entity unmarshalled to a given type
extract Extracts a single value using a RequestContext T function
extractClientIP Extracts the client's IP from either the X-Forwarded-, Remote-Address or X-Real-IP header
extractCredentials Extracts the potentially present HttpCredentials provided with the request's Authorization header
extractExecutionContext Extracts the ExecutionContext from the RequestContext
extractMaterializer Extracts the Materializer from the RequestContext
extractHostName Extracts the hostname part of the Host request header value
extractLog Extracts the LoggingAdapter from the RequestContext
extractMethod Extracts the request method
extractRequest Extracts the current HttpRequest instance
extractRequestContext Extracts the RequestContext itself
extractScheme Extracts the URI scheme from the request
extractSettings Extracts the RoutingSettings from the RequestContext
extractUnmatchedPath Extracts the yet unmatched path from the RequestContext
extractUri Extracts the complete request URI
failWith Bubbles the given error up the response chain where it is dealt with by the closest handleExceptions directive and its ExceptionHandler
fileUpload Provides a stream of an uploaded file from a multipart request
formField Extracts an HTTP form field from the request
formFieldMap Extracts a number of HTTP form field from the request as a Map<String, String>
formFieldMultiMap Extracts a number of HTTP form field from the request as a Map<String, List<String>
formFieldList Extracts a number of HTTP form field from the request as a List<Pair<String, String>>
get Rejects all non-GET requests
getFromBrowseableDirectories Serves the content of the given directories as a file-system browser, i.e. files are sent and directories served as browseable listings
getFromBrowseableDirectory Serves the content of the given directory as a file-system browser, i.e. files are sent and directories served as browseable listings
getFromDirectory Completes GET requests with the content of a file underneath a given file-system directory
getFromFile Completes GET requests with the content of a given file
getFromResource Completes GET requests with the content of a given class-path resource
getFromResourceDirectory Completes GET requests with the content of a file underneath a given "class-path resource directory"
handleExceptions Transforms exceptions thrown during evaluation of the inner route using the given ExceptionHandler
handleRejections Transforms rejections produced by the inner route using the given RejectionHandler
handleWebSocketMessages Handles websocket requests with the given handler and rejects other requests with an ExpectedWebSocketRequestRejection
handleWebSocketMessagesForProtocol Handles websocket requests with the given handler if the subprotocol matches and rejects other requests with an ExpectedWebSocketRequestRejection or an UnsupportedWebSocketSubprotocolRejection.
handleWith Completes the request using a given function
head Rejects all non-HEAD requests
headerValue Extracts an HTTP header value using a given HttpHeader Option<T> function
headerValueByName Extracts the value of the first HTTP request header with a given name
headerValueByType Extracts the first HTTP request header of the given type
headerValuePF Extracts an HTTP header value using a given PartialFunction<HttpHeader, T>
host Rejects all requests with a non-matching host name
listDirectoryContents Completes GET requests with a unified listing of the contents of all given file-system directories
logRequest Produces a log entry for every incoming request
logRequestResult Produces a log entry for every incoming request and RouteResult
logResult Produces a log entry for every RouteResult
mapInnerRoute Transforms its inner Route with a Route => Route function
mapRejections Transforms rejections from a previous route with an List<Rejection] List<Rejection> function
mapRequest Transforms the request with an HttpRequest => HttpRequest function
mapRequestContext Transforms the RequestContext with a RequestContext => RequestContext function
mapResponse Transforms the response with an HttpResponse => HttpResponse function
mapResponseEntity Transforms the response entity with an ResponseEntity ResponseEntity function
mapResponseHeaders Transforms the response headers with an List<HttpHeader] List<HttpHeader> function
mapRouteResult Transforms the RouteResult with a RouteResult RouteResult function
mapRouteResultFuture Transforms the RouteResult future with a CompletionStage<RouteResult] CompletionStage<RouteResult> function
mapRouteResultPF Transforms the RouteResult with a PartialFunction<RouteResult, RouteResult>
mapRouteResultWith Transforms the RouteResult with a RouteResult CompletionStage<RouteResult> function
mapRouteResultWithPF Transforms the RouteResult with a PartialFunction<RouteResult, CompletionStage<RouteResult]>
mapSettings Transforms the RoutingSettings with a RoutingSettings RoutingSettings function
mapUnmatchedPath Transforms the unmatchedPath of the RequestContext using a Uri.Path Uri.Path function
method Rejects all requests whose HTTP method does not match the given one
onComplete "Unwraps" a CompletionStage<T> and runs the inner route after future completion with the future's value as an extraction of type Try<T>
onCompleteWithBreaker "Unwraps" a CompletionStage<T> inside a CircuitBreaker and runs the inner route after future completion with the future's value as an extraction of type Try<T>
onSuccess "Unwraps" a CompletionStage<T> and runs the inner route after future completion with the future's value as an extraction of type T
optionalCookie Extracts the HttpCookiePair with the given name as an Option<HttpCookiePair>
optionalHeaderValue Extracts an optional HTTP header value using a given HttpHeader Option<T> function
optionalHeaderValueByName Extracts the value of the first optional HTTP request header with a given name
optionalHeaderValueByType Extracts the first optional HTTP request header of the given type
optionalHeaderValuePF Extracts an optional HTTP header value using a given PartialFunction<HttpHeader, T>
options Rejects all non-OPTIONS requests
overrideMethodWithParameter Changes the request method to the value of the specified query parameter
parameter Extracts a query parameter value from the request
parameterMap Extracts the request's query parameters as a Map<String, String>
parameterMultiMap Extracts the request's query parameters as a Map<String, List<String>>
parameterList Extracts the request's query parameters as a Seq<Pair<String, String>>
pass Always simply passes the request on to its inner route, i.e. doesn't do anything, neither with the request nor the response
patch Rejects all non-PATCH requests
path Applies the given PathMatcher to the remaining unmatched path after consuming a leading slash
pathEnd Only passes on the request to its inner route if the request path has been matched completely
pathEndOrSingleSlash Only passes on the request to its inner route if the request path has been matched completely or only consists of exactly one remaining slash
pathPrefix Applies the given PathMatcher to a prefix of the remaining unmatched path after consuming a leading slash
pathPrefixTest Checks whether the unmatchedPath has a prefix matched by the given PathMatcher after implicitly consuming a leading slash
pathSingleSlash Only passes on the request to its inner route if the request path consists of exactly one remaining slash
pathSuffix Applies the given PathMatcher to a suffix of the remaining unmatched path (Caution: check java!)
pathSuffixTest Checks whether the unmatched path has a suffix matched by the given PathMatcher (Caution: check java!)
post Rejects all non-POST requests
provide Injects a given value into a directive
put Rejects all non-PUT requests
rawPathPrefix Applies the given matcher directly to a prefix of the unmatched path of the RequestContext, without implicitly consuming a leading slash
rawPathPrefixTest Checks whether the unmatchedPath has a prefix matched by the given PathMatcher
recoverRejections Transforms rejections from the inner route with an List<Rejection] RouteResult function
recoverRejectionsWith Transforms rejections from the inner route with an List<Rejection] CompletionStage<RouteResult> function
redirect Completes the request with redirection response of the given type to the given URI
redirectToNoTrailingSlashIfPresent If the request path ends with a slash, redirects to the same uri without trailing slash in the path
redirectToTrailingSlashIfMissing If the request path doesn't end with a slash, redirects to the same uri with trailing slash in the path
reject Rejects the request with the given rejections
rejectEmptyResponse Converts responses with an empty entity into (empty) rejections
requestEncodedWith Rejects the request with an UnsupportedRequestEncodingRejection if its encoding doesn't match the given one
requestEntityEmpty Rejects if the request entity is non-empty
requestEntityPresent Rejects with a RequestEntityExpectedRejection if the request entity is empty
respondWithDefaultHeader Adds a given response header if the response doesn't already contain a header with the same name
respondWithDefaultHeaders Adds the subset of the given headers to the response which doesn't already have a header with the respective name present in the response
respondWithHeader Unconditionally adds a given header to the outgoing response
respondWithHeaders Unconditionally adds the given headers to the outgoing response
responseEncodingAccepted Rejects the request with an UnacceptedResponseEncodingRejection if the given response encoding is not accepted by the client
scheme Rejects all requests whose URI scheme doesn't match the given one
selectPreferredLanguage Inspects the request's Accept-Language header and determines, which of a given set of language alternatives is preferred by the client
setCookie Adds a Set-Cookie response header with the given cookies
uploadedFile Streams one uploaded file from a multipart request to a file on disk
validate Checks a given condition before running its inner route
withoutRequestTimeout Disables request timeouts for a given route.
withoutSizeLimit Skips request entity size check
withExecutionContext Runs its inner route with the given alternative ExecutionContext
withMaterializer Runs its inner route with the given alternative Materializer
withLog Runs its inner route with the given alternative LoggingAdapter
withRangeSupport Adds Accept-Ranges: bytes to responses to GET requests, produces partial responses if the initial request contained a valid Range header
withRequestTimeout Configures the request timeouts for a given route.
withRequestTimeoutResponse Prepares the HttpResponse that is emitted if a request timeout is triggered. RequestContext => RequestContext function
withSettings Runs its inner route with the given alternative RoutingSettings
withSizeLimit Applies request entity size check

Contents