A PathMatcher that matches and extracts a Double value.
A PathMatcher that matches and extracts a Double value. The matched string representation is the pure decimal, optionally signed form of a double value, i.e. without exponent.
A PathMatcher that efficiently matches a number of hex-digits and extracts their (non-negative) Int value.
A PathMatcher that efficiently matches a number of hex-digits and extracts their (non-negative) Long value.
A PathMatcher that efficiently matches a number of digits and extracts their (non-negative) Int value.
A PathMatcher that matches and extracts a java.
A PathMatcher that matches and extracts a java.util.UUID instance.
A PathMatcher that efficiently matches a number of digits and extracts their (non-negative) Long value.
A PathMatcher that always matches, doesn't consume anything and extracts nothing.
A PathMatcher that always matches, doesn't consume anything and extracts nothing. Serves mainly as a neutral element in PathMatcher composition.
A PathMatcher that matches the very end of the requests URI path.
A PathMatcher that matches and extracts the complete remaining, unmatched part of the request's URI path as an (encoded!) String.
A PathMatcher that matches and extracts the complete remaining, unmatched part of the request's URI path.
A PathMatcher that matches if the unmatched path starts with a path segment.
A PathMatcher that matches all remaining segments as a List[String].
A PathMatcher that matches all remaining segments as a List[String]. This can also be no segments resulting in the empty list. If the path has a trailing slash this slash will *not* be matched.
A PathMatcher that matches a single slash character ('/').
Returns the in-scope FromRequestUnmarshaller for the given type.
Returns the in-scope FromRequestUnmarshaller for the given type.
Wraps its inner Route with authentication support.
Wraps its inner Route with authentication support.
Can be called either with a
or Future[Authentication[T]]
.
ContextAuthenticator[T]
Applies the given authorization check to the request.
Applies the given authorization check to the request. If the check fails the route is rejected with an spray.AuthorizationFailedRejection.
Applies the given authorization check to the request.
Applies the given authorization check to the request. If the check fails the route is rejected with an spray.AuthorizationFailedRejection.
Converts unchunked HttpResponses coming back from its inner route into chunked responses of which each chunk is smaller or equal to the given size, if the response entity is at least as large as the given threshold.
Converts unchunked HttpResponses coming back from its inner route into chunked responses of which each chunk is smaller or equal to the given size, if the response entity is at least as large as the given threshold. If the response content from the inner route is smaller than the given threshold the response is left untouched.
Converts unchunked HttpResponses coming back from its inner route into chunked responses of which each chunk is smaller or equal to the given size, if the response entity contains HttpData.
Converts unchunked HttpResponses coming back from its inner route into chunked responses of which each chunk is smaller or equal to the given size, if the response entity contains HttpData.FileBytes and is at least as large as the given threshold. If the response content from the inner route is smaller than the given threshold the response is left untouched.
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.
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.
Adds a TransformationRejection cancelling all rejections equal to the given one to the list of rejections potentially coming back from the inner route.
Adds a TransformationRejection cancelling all rejections equal to the given one to the list of rejections potentially coming back from the inner route.
Directive extracting the IP of the client from either the X-Forwarded-For, Remote-Address or X-Real-IP header (in that order of priority).
Directive extracting the IP of the client from either the X-Forwarded-For, Remote-Address or X-Real-IP header (in that order of priority).
Completes the request using the given arguments.
Completes the request using the given arguments.
Wraps its inner Route with response compression, using the specified encoders in the given order of preference.
Wraps its inner Route with response compression, using the specified encoders in the given order of preference. If no encoders are specifically given Gzip, Deflate and NoEncoding are used in this order, depending on what the client accepts.
Wraps its inner Route with response compression if and only if the client
specifically requests compression with an Accept-Encoding
header.
Wraps its inner Route with response compression if and only if the client
specifically requests compression with an Accept-Encoding
header.
Wraps its inner route with support for Conditional Requests as defined by tools.
Wraps its inner route with support for Conditional Requests as defined by tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26
In particular the algorithm defined by tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-6 is implemented by this directive.
Note: if you want to combine this directive with withRangeSupport(...)
you need to put
it on the *outside* of the withRangeSupport(...)
directive, i.e. withRangeSupport(...)
must be on a deeper level in your route structure in order to function correctly.
Extracts an HttpCookie with the given name.
Extracts an HttpCookie with the given name. If the cookie is not present the request is rejected with a respective spray.routing.MissingCookieRejection.
Wraps its inner Route with decoding support using the given Decoder.
Wraps its inner Route with decoding support using the given Decoder.
Decompresses the incoming request if it is encoded with one of the given encoders.
Decompresses the incoming request if it is encoded with one of the given
encoders. If the request encoding doesn't match one of the given encoders
the request is rejected with an UnsupportedRequestEncodingRejection
.
Decompresses the incoming request if it is GZip or Deflate encoded.
Decompresses the incoming request if it is GZip or Deflate encoded. Uncompressed requests are passed on to the inner route unchanged.
A route filter that rejects all non-DELETE requests.
A route filter that rejects all non-DELETE requests.
Adds a Set-Cookie header expiring the given cookie to all responses of its inner route.
Adds a Set-Cookie header expiring the given cookie to all responses of its inner route.
Adds a Set-Cookie header expiring the given cookies to all responses of its inner route.
Adds a Set-Cookie header expiring the given cookies to all responses of its inner route.
Executes its inner Route in a Future
.
Executes its inner Route in a Future
.
Wraps its inner Route with encoding support using the given Encoder.
Wraps its inner Route with encoding support using the given Encoder.
Unmarshalls the requests entity to the given type passes it to its inner Route.
Unmarshalls the requests entity to the given type passes it to its inner Route. If there is a problem with unmarshalling the request is rejected with the spray.routing.Rejection produced by the unmarshaller.
Extracts a single value using the given function.
Extracts a single value using the given function.
Bubbles the given error up the response chain, where it is dealt with by the closest handleExceptions
directive and its ExceptionHandler.
Bubbles the given error up the response chain, where it is dealt with by the closest handleExceptions
directive and its ExceptionHandler.
A route filter that rejects all non-GET requests.
A route filter that rejects all non-GET requests.
Serves the content of the given directories as a file system browser, i.
Serves the content of the given directories as a file system browser, i.e. files are sent and directories served as browsable listings.
Same as getFromBrowseableDirectories
with only one directory.
Same as getFromBrowseableDirectories
with only one directory.
Completes GET requests with the content of a file underneath the given directory.
Completes GET requests with the content of a file underneath the given directory.
The unmatchedPath of the spray.RequestContext is first transformed by the given pathRewriter function before
being appended to the given directoryName to build the final fileName.
The actual I/O operation is running detached in a Future
, so it doesn't block the
current thread. If the file cannot be read the Route rejects the request.
Completes GET requests with the content of the given file.
Completes GET requests with the content of the given file. The actual I/O operation is
running detached in a Future
, so it doesn't block the current thread (but potentially
some other thread !). If the file cannot be found or read the request is rejected.
Completes GET requests with the content of the given file.
Completes GET requests with the content of the given file. The actual I/O operation is
running detached in a Future
, so it doesn't block the current thread (but potentially
some other thread !). If the file cannot be found or read the request is rejected.
Completes GET requests with the content of the given file.
Completes GET requests with the content of the given file. The actual I/O operation is
running detached in a Future
, so it doesn't block the current thread (but potentially
some other thread !). If the file cannot be found or read the request is rejected.
Completes GET requests with the content of the given resource.
Completes GET requests with the content of the given resource. The actual I/O operation is
running detached in a Future
, so it doesn't block the current thread (but potentially
some other thread !).
If the file cannot be found or read the Route rejects the request.
Completes GET requests with the content of the given resource.
Completes GET requests with the content of the given resource. The actual I/O operation is
running detached in a Future
, so it doesn't block the current thread (but potentially
some other thread !).
If the file cannot be found or read the Route rejects the request.
Same as "getFromDirectory" except that the file is not fetched from the file system but rather from a "resource directory".
Same as "getFromDirectory" except that the file is not fetched from the file system but rather from a "resource directory".
Transforms exceptions thrown during evaluation of its inner route using the given spray.routing.ExceptionHandler.
Transforms exceptions thrown during evaluation of its inner route using the given spray.routing.ExceptionHandler.
Transforms rejections produced by its inner route using the given spray.routing.RejectionHandler.
Transforms rejections produced by its inner route using the given spray.routing.RejectionHandler.
Completes the request using the given function.
Completes the request using the given function. The input to the function is produced with the in-scope entity unmarshaller and the result value of the function is marshalled with the in-scope marshaller.
A route filter that rejects all non-HEAD requests.
A route filter that rejects all non-HEAD requests.
Extracts an HTTP header value using the given function.
Extracts an HTTP header value using the given function. If the function result is undefined for all headers the request is rejected with an empty rejection set. If the given function throws an exception the request is rejected with a spray.routing.MalformedHeaderRejection.
Extracts the value of the HTTP request header with the given name.
Extracts the value of the HTTP request header with the given name. If no header with a matching name is found the request is rejected with a spray.routing.MissingHeaderRejection.
Extracts the value of the HTTP request header with the given name.
Extracts the value of the HTTP request header with the given name. If no header with a matching name is found the request is rejected with a spray.routing.MissingHeaderRejection.
Extracts the HTTP request header of the given type.
Extracts the HTTP request header of the given type. If no header with a matching type is found the request is rejected with a spray.routing.MissingHeaderRejection.
Extracts an HTTP header value using the given partial function.
Extracts an HTTP header value using the given partial function. If the function is undefined for all headers the request is rejected with an empty rejection set.
Extracts a number of values using the given function.
Extracts a number of values using the given function.
Rejects all requests with a host name that doesn't have a prefix matching the given regular expression.
Rejects all requests with a host name that doesn't have a prefix matching the given regular expression. For all matching requests the prefix string matching the regex is extracted and passed to the inner route. If the regex contains a capturing group only the string matched by this group is extracted. If the regex contains more than one capturing group an IllegalArgumentException is thrown.
Rejects all requests for whose host name the given predicate function returns false.
Rejects all requests for whose host name the given predicate function returns false.
Rejects all requests with a host name different from the given ones.
Rejects all requests with a host name different from the given ones.
Extracts the hostname part of the Host header value in the request.
Extracts the hostname part of the Host header value in the request.
Injects the given values into a directive.
Injects the given values into a directive.
Returns the in-scope Marshaller for the given type.
Returns the in-scope Marshaller for the given type.
Wraps the inner Route with JSONP support.
Wraps the inner Route with JSONP support. If a query parameter with the given name is present in the request and
the inner Route returns content with content-type application/json
the response content is wrapped with a call
to a Javascript function having the name of query parameters value. The name of this function is validated to
prevent XSS vulnerabilities. Only alphanumeric, underscore (_), dollar ($) and dot (.) characters are allowed.
Additionally the content-type is changed from application/json
to application/javascript
in these cases.
Completes GET requests with a unified listing of the contents of all given directories.
Completes GET requests with a unified listing of the contents of all given directories.
The actual rendering of the directory contents is performed by the in-scope Marshaller[DirectoryListing]
.
Rejects all requests whose HTTP method does not match the given one.
Rejects all requests whose HTTP method does not match the given one.
A Directive0 that always passes the request on to its inner route (i.
A Directive0 that always passes the request on to its inner route (i.e. does nothing with the request or the response).
"Unwraps" a
and runs its inner route after future
completion with the future's value as an extraction of type Future[T]
.Try[T]
"Unwraps" a
and runs its inner route after future
completion with the future's value as an extraction of type Future[T]
.
Try[T]
Called by the runRoute
behavior when a ConnectionClosed
event is received.
Called by the runRoute
behavior when a ConnectionClosed
event is received.
Override with custom logic if required (by default the method does nothing).
"Unwraps" a
and runs its inner route when the future has failed
with the future's failure exception as an extraction of type Future[T]
.Throwable
"Unwraps" a
and runs its inner route when the future has failed
with the future's failure exception as an extraction of type Future[T]
.
If the future succeeds the request is completed using the values marshaller
(This directive therefore requires a marshaller for the futures type to be
implicitly available.)
Throwable
"Unwraps" a
and runs its inner route after future
completion with the future's value as an extraction of type Future[T]
.T
"Unwraps" a
and runs its inner route after future
completion with the future's value as an extraction of type Future[T]
.
If the future fails its failure throwable is bubbled up to the nearest
ExceptionHandler.
If type T
is already an HList it is directly expanded into the respective
number of extractions.
T
Extracts an HttpCookie with the given name.
Extracts an HttpCookie with the given name.
If the cookie is not present a value of None
is extracted.
Extracts an optional HTTP header value using the given function.
Extracts an optional HTTP header value using the given function. If the given function throws an exception the request is rejected with a spray.routing.MalformedHeaderRejection.
Extracts the value of the optional HTTP request header with the given name.
Extracts the value of the optional HTTP request header with the given name.
Extracts the value of the optional HTTP request header with the given name.
Extracts the value of the optional HTTP request header with the given name.
Extract the header value of the optional HTTP request header with the given type.
Extract the header value of the optional HTTP request header with the given type.
Extracts an optional HTTP header value using the given partial function.
Extracts an optional HTTP header value using the given partial function. If the given function throws an exception the request is rejected with a spray.routing.MalformedHeaderRejection.
A route filter that rejects all non-OPTIONS requests.
A route filter that rejects all non-OPTIONS requests.
Changes the HTTP method of the request to the value of the specified query string parameter.
Changes the HTTP method of the request to the value of the specified query string parameter. If the query string
parameter is not specified this directive has no effect. If the query string is specified as something that is not
a HTTP method, then this directive completes the request with a 501 Not Implemented
response.
This directive is useful for:
Extracts the requests query parameters as a Map[String, String].
Extracts the requests query parameters as a Map[String, String].
Extracts the requests query parameters as a Map[String, List[String]].
Extracts the requests query parameters as a Map[String, List[String]].
Extracts the requests query parameters as a Seq[(String, String)].
Extracts the requests query parameters as a Seq[(String, String)].
A simple alias for the noop
directive.
A simple alias for the noop
directive.
A route filter that rejects all non-PATCH requests.
A route filter that rejects all non-PATCH requests.
Tries to consume a leading slash from the unmatched path of the spray.routing.RequestContext before applying the given matcher.
Tries to consume a leading slash from the unmatched path of the spray.routing.RequestContext before applying the given matcher. The matcher has to match the remaining path completely or leave only a single trailing slash. If matched the value extracted by the PathMatcher is extracted on the directive level.
Rejects the request if the unmatchedPath of the spray.RequestContext is non-empty, or said differently: only passes on the request to its inner route if the request path has been matched completely.
Rejects the request if the unmatchedPath of the spray.RequestContext is non-empty, or said differently: only passes on the request to its inner route if the request path has been matched completely.
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.
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.
Tries to consume a leading slash from the unmatched path of the spray.routing.RequestContext before applying the given matcher.
Tries to consume a leading slash from the unmatched path of the spray.routing.RequestContext before applying the given matcher. The matcher has to match a prefix of the remaining path. If matched the value extracted by the PathMatcher is extracted on the directive level.
Checks whether the unmatchedPath of the spray.RequestContext has a prefix matched by the given PathMatcher.
Checks whether the unmatchedPath of the spray.RequestContext has a prefix matched by the
given PathMatcher. In analogy to the pathPrefix
directive a leading slash is implied.
Only passes on the request to its inner route if the request path consists of exactly one remaining slash.
Only passes on the request to its inner route if the request path consists of exactly one remaining slash.
Rejects the request if the unmatchedPath of the spray.RequestContext does not have a suffix matched the given PathMatcher.
Rejects the request if the unmatchedPath of the spray.RequestContext does not have a suffix
matched the given PathMatcher. If matched the value extracted by the PathMatcher is extracted
and the matched parts of the path are consumed.
Note that, for efficiency reasons, the given PathMatcher must match the desired suffix in reversed-segment
order, i.e. pathSuffix("baz" / "bar")
would match /foo/bar/baz
!
Checks whether the unmatchedPath of the spray.RequestContext has a suffix matched by the given PathMatcher.
Checks whether the unmatchedPath of the spray.RequestContext has a suffix matched by the
given PathMatcher. However, as opposed to the pathSuffix directive the matched path is not
actually "consumed".
Note that, for efficiency reasons, the given PathMatcher must match the desired suffix in reversed-segment
order, i.e. pathSuffixTest("baz" / "bar")
would match /foo/bar/baz
!
A route filter that rejects all non-POST requests.
A route filter that rejects all non-POST requests.
Uses the marshaller for the given type to produce a completion function that is passed to its inner route.
Uses the marshaller for the given type to produce a completion function that is passed to its inner route. You can use it do decouple marshaller resolution from request completion.
Injects the given value into a directive.
Injects the given value into a directive.
A route filter that rejects all non-PUT requests.
A route filter that rejects all non-PUT requests.
Applies the given matcher directly to the unmatched path of the spray.routing.RequestContext (i.
Applies the given matcher directly to the unmatched path of the spray.routing.RequestContext (i.e. without implicitly consuming a leading slash). The matcher has to match a prefix of the remaining path. If matched the value extracted by the PathMatcher is extracted on the directive level.
Checks whether the unmatchedPath of the spray.RequestContext has a prefix matched by the given PathMatcher.
Checks whether the unmatchedPath of the spray.RequestContext has a prefix matched by the
given PathMatcher. However, as opposed to the pathPrefix
directive the matched path is not
actually "consumed".
Completes the request with redirection response of the given type to the given URI.
Completes the request with redirection response of the given type to the given URI.
Creates a PathMatcher that consumes (a prefix of) the first path segment if the path begins with a segment (a prefix of) which matches the given regex.
Creates a PathMatcher that consumes (a prefix of) the first path segment if the path begins with a segment (a prefix of) which matches the given regex. Extracts either the complete match (if the regex doesn't contain a capture group) or the capture group (if the regex contains exactly one). If the regex contains more than one capture group the method throws an IllegalArgumentException.
Rejects the request with the given rejections.
Rejects the request with the given rejections.
Rejects the request with an empty set of rejections.
Rejects the request with an empty set of rejections.
Converts responses with an empty entity into (empty) rejections.
Converts responses with an empty entity into (empty) rejections. This way you can, for example, have the marshalling of a None option be treated as if the request could not be matched.
Rejects the request with an UnsupportedRequestEncodingRejection if its encoding doesn't match the given one.
Rejects the request with an UnsupportedRequestEncodingRejection if its encoding doesn't match the given one.
Rejects the request if its entity is not empty.
Rejects the request if its entity is not empty.
Rejects empty requests with a RequestEntityExpectedRejection.
Rejects empty requests with a RequestEntityExpectedRejection. Non-empty requests are passed on unchanged to the inner route.
Extracts the complete request.
Extracts the complete request.
Extracts the complete request URI.
Extracts the complete request URI.
Unconditionally adds the given response header to all HTTP responses of its inner Route.
Unconditionally adds the given response header to all HTTP responses of its inner Route.
Unconditionally adds the given response headers to all HTTP responses of its inner Route.
Unconditionally adds the given response headers to all HTTP responses of its inner Route.
Unconditionally adds the given response headers to all HTTP responses of its inner Route.
Unconditionally adds the given response headers to all HTTP responses of its inner Route.
Adds a Last-Modified header to all HttpResponses from its inner Route.
Adds a Last-Modified header to all HttpResponses from its inner Route.
Overrides the media-type of the response returned by its inner route with the given one.
Overrides the media-type of the response returned by its inner route with the given one. If the given media-type is not accepted by the client the request is rejected with an UnacceptedResponseContentTypeRejection. Note, that this directive removes a potentially existing 'Accept' header from the request, in order to "disable" content negotiation in a potentially running Marshaller in its inner route. Also note that this directive does *not* change the response entity buffer content in any way, it merely overrides the media-type component of the entities Content-Type.
Adds the given response header to all HTTP responses of its inner Route, if the response from the inner Route doesn't already contain a header with the same name.
Adds the given response header to all HTTP responses of its inner Route, if the response from the inner Route doesn't already contain a header with the same name.
Adds the given response headers to all HTTP responses of its inner Route, if a header already exists it is not added again.
Adds the given response headers to all HTTP responses of its inner Route, if a header already exists it is not added again.
Overrides the given response status on all HTTP responses of its inner Route.
Overrides the given response status on all HTTP responses of its inner Route.
Rejects the request with an UnacceptedResponseEncodingRejection if the given encoding is not accepted for the response.
Rejects the request with an UnacceptedResponseEncodingRejection if the given encoding is not accepted for the response.
Transforms the unmatchedPath of the RequestContext using the given function.
Transforms the unmatchedPath of the RequestContext using the given function.
Supplies the actor behavior for executing the given route.
Supplies the actor behavior for executing the given route.
Rejects all requests whose Uri scheme does not match the given one.
Rejects all requests whose Uri scheme does not match the given one.
Extracts the Uri scheme from the request.
Extracts the Uri scheme from the request.
"Seals" a route by wrapping it with exception handling and rejection conversion.
"Seals" a route by wrapping it with exception handling and rejection conversion.
Creates a PathMatcher that consumes (a prefix of) the first path segment (if the path begins with a segment).
Creates a PathMatcher that consumes (a prefix of) the first path segment (if the path begins with a segment).
Converts a path string containing slashes into a PathMatcher that interprets slashes as path segment separators.
Converts a path string containing slashes into a PathMatcher that interprets slashes as path segment separators.
Adds a Set-Cookie header with the given cookies to all responses of its inner route.
Adds a Set-Cookie header with the given cookies to all responses of its inner route.
Creates a PathMatcher that consumes (a prefix of) the first path segment (if the path begins with a segment) and extracts a given value.
Creates a PathMatcher that consumes (a prefix of) the first path segment (if the path begins with a segment) and extracts a given value.
Extracts the unmatched path from the RequestContext.
Extracts the unmatched path from the RequestContext.
Returns a Directive which checks the given condition before passing on the spray.routing.RequestContext to its inner Route.
Returns a Directive which checks the given condition before passing on the spray.routing.RequestContext to its inner Route. If the condition fails the route is rejected with a spray.routing.ValidationRejection.
Creates a PathMatcher from the given Map of path segments (prefixes) to extracted values.
Creates a PathMatcher from the given Map of path segments (prefixes) to extracted values. If the unmatched path starts with a segment having one of the maps keys as a prefix the matcher consumes this path segment (prefix) and extracts the corresponding map value.
Answers GET requests with an Accept-Ranges: bytes
header and converts HttpResponses coming back from its inner
route into partial responses if the initial request contained a valid Range
request header.
Answers GET requests with an Accept-Ranges: bytes
header and converts HttpResponses coming back from its inner
route into partial responses if the initial request contained a valid Range
request header. The requested
byte-ranges may be coalesced.
This directive is transparent to non-GET requests
Rejects requests with unsatisfiable ranges UnsatisfiableRangeRejection
.
Rejects requests with too many expected ranges.
Note: if you want to combine this directive with conditional(...)
you need to put
it on the *inside* of the conditional(...)
directive, i.e. conditional(...)
must be
on a higher level in your route structure in order to function correctly.
https://tools.ietf.org/html/draft-ietf-httpbis-p5-range/
(Since version 1.0-M8/1.1-M8) Use Segment
instead