=htc,doc #18496 make all directive docs have the same style, some
additions
This commit is contained in:
parent
bb053bea2a
commit
cddb1ade40
103 changed files with 212 additions and 335 deletions
|
|
@ -1,4 +1,4 @@
|
|||
.. _MethodDirectives:
|
||||
.. _method-directives-java:
|
||||
|
||||
MethodDirectives
|
||||
================
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ Description
|
|||
-----------
|
||||
``FormField`` request values allow extracting fields submitted as ``application/x-www-form-urlencoded`` values or concrete instances from HTTP requests.
|
||||
|
||||
The ``RequestVal`` builder is made up of 2 steps, initially you need to pick which Header to extract (``byName`` or
|
||||
``byClass``) and then you need to pick if the header is optionally available or required (i.e. the route should not
|
||||
match if the header is not present in the request). This is done using one of the below depicted methods::
|
||||
The ``FormField`` request value builder is made up of 2 steps, initially you need to pick which what type of value you
|
||||
want to extract from the field (for example ``intValue``, which would reject the route if the value is not an ``int``),
|
||||
and then **optionally** you may specify if the value is optional (by calling ``optional()`` on the ``RequestVal``)
|
||||
or has a default value (by calling ``withDefault()`` on the ``RequestVal``).
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
|
|
|||
|
|
@ -43,3 +43,12 @@ akka.http.javadsl.server.values.FormFieldsPathMatchers
|
|||
Contains request values to match and access URI path segments.
|
||||
akka.http.javadsl.server.values.FormFieldsCustomRequestVal
|
||||
An abstract class to implement arbitrary custom request values.
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
form-field-request-vals
|
||||
header-request-vals
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Directive Description
|
|||
a given ``AsyncAuthenticator[T]``
|
||||
:ref:`-authenticateOAuth2PF-` Wraps the inner route with OAuth Bearer Token authentication support using
|
||||
a given ``AuthenticatorPF[T]``
|
||||
:ref:`-authenticateOAuth2AsyncPF-` Wraps the inner route with OAuth Bearer Token authentication support using
|
||||
:ref:`-authenticateOAuth2PFAsync-` Wraps the inner route with OAuth Bearer Token authentication support using
|
||||
a given ``AsyncAuthenticatorPF[T]``
|
||||
:ref:`-authenticateOrRejectWithChallenge-` Lifts an authenticator function into a directive
|
||||
:ref:`-authorize-` Applies the given authorization check to the request
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Signature
|
|||
Description
|
||||
-----------
|
||||
|
||||
Asynchronous variant of :ref:`mapRouteResultPF`.
|
||||
Asynchronous variant of :ref:`-mapRouteResultPF-`.
|
||||
|
||||
Changes the message the inner route sends to the responder.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
recoverRejectionsWith
|
||||
=====================
|
||||
|
||||
Transforms rejections from the inner route with an ``immutable.Seq[Rejection] ⇒ Future[RouteResult]`` function.
|
||||
|
||||
Asynchronous version of :ref:`-recoverRejections-`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -19,6 +15,10 @@ Description
|
|||
**Low level directive** – unless you're sure you need to be working on this low-level you might instead
|
||||
want to try the :ref:`-handleRejections-` directive which provides a nicer DSL for building rejection handlers.
|
||||
|
||||
Transforms rejections from the inner route with an ``immutable.Seq[Rejection] ⇒ Future[RouteResult]`` function.
|
||||
|
||||
Asynchronous version of :ref:`-recoverRejections-`.
|
||||
|
||||
See :ref:`-recoverRejections-` (the synchronous equivalent of this directive) for a detailed description.
|
||||
|
||||
.. note::
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
textract
|
||||
========
|
||||
|
||||
Calculates a tuple of values from the request context and provides them to the inner route.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Extracts a tuple of values from the request context and provides them to the inner route.
|
||||
|
||||
|
||||
The ``textract`` directive is used as a building block for :ref:`Custom Directives` to extract data from the
|
||||
``RequestContext`` and provide it to the inner route. To extract just one value use the :ref:`-extract-` directive. To
|
||||
|
|
@ -20,6 +20,8 @@ provide a constant value independent of the ``RequestContext`` use the :ref:`-tp
|
|||
|
||||
See :ref:`ProvideDirectives` for an overview of similar directives.
|
||||
|
||||
See also :ref:`-extract-` for extracting a single value.
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
tprovide
|
||||
========
|
||||
|
||||
Provides a tuple of values to the inner route.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
|
@ -14,12 +13,15 @@ Signature
|
|||
Description
|
||||
-----------
|
||||
|
||||
Provides a tuple of values to the inner route.
|
||||
|
||||
The ``tprovide`` directive is used as a building block for :ref:`Custom Directives` to provide data to the inner route.
|
||||
To provide just one value use the :ref:`-provide-` directive. If you want to provide values calculated from the
|
||||
``RequestContext`` use the :ref:`-textract-` directive instead.
|
||||
|
||||
See :ref:`ProvideDirectives` for an overview of similar directives.
|
||||
|
||||
See also :ref:`-provide-` for providing a single value.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
withExecutionContext
|
||||
====================
|
||||
|
||||
Runs its inner route with the given alternative :class:`ExecutionContext`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
withLog
|
||||
=======
|
||||
|
||||
Runs its inner route with the given alternative :class:`LoggingAdapter`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
withMaterializer
|
||||
================
|
||||
|
||||
Runs its inner route with the given alternative ``Materializer``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
withSettings
|
||||
============
|
||||
|
||||
Runs its inner route with the given alternative :class:`RoutingSettings`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
conditional
|
||||
===========
|
||||
|
||||
Wraps its inner route with support for Conditional Requests as defined
|
||||
by http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -17,6 +13,10 @@ Signature
|
|||
Description
|
||||
-----------
|
||||
|
||||
Wraps its inner route with support for Conditional Requests as defined
|
||||
by http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26.
|
||||
|
||||
|
||||
Depending on the given ``eTag`` and ``lastModified`` values this directive immediately responds with
|
||||
``304 Not Modified`` or ``412 Precondition Failed`` (without calling its inner route) if the request comes with the
|
||||
respective conditional headers. Otherwise the request is simply passed on to its inner route.
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
cookie
|
||||
======
|
||||
|
||||
Extracts a cookie with a given name from a request or otherwise rejects the request with a ``MissingCookieRejection`` if
|
||||
the cookie is missing.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,6 +11,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Extracts a cookie with a given name from a request or otherwise rejects the request with a ``MissingCookieRejection`` if
|
||||
the cookie is missing.
|
||||
|
||||
Use the :ref:`-optionalCookie-` directive instead if you want to support missing cookies in your inner route.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
deleteCookie
|
||||
============
|
||||
|
||||
Adds a header to the response to request the removal of the cookie with the given name on the client.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Adds a header to the response to request the removal of the cookie with the given name on the client.
|
||||
|
||||
Use the :ref:`-setCookie-` directive to update a cookie.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
optionalCookie
|
||||
==============
|
||||
|
||||
Extracts an optional cookie with a given name from a request.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Extracts an optional cookie with a given name from a request.
|
||||
|
||||
Use the :ref:`-cookie-` directive instead if the inner route does not handle a missing cookie.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
setCookie
|
||||
=========
|
||||
|
||||
Adds a header to the response to request the update of the cookie with the given name on the client.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Adds a header to the response to request the update of the cookie with the given name on the client.
|
||||
|
||||
Use the :ref:`-deleteCookie-` directive to delete a cookie.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
logRequest
|
||||
==========
|
||||
|
||||
Logs the request.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
logRequestResult
|
||||
================
|
||||
|
||||
Logs request and response.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -23,9 +21,11 @@ The signature shown is simplified, the real signature uses magnets. [1]_
|
|||
|
||||
Description
|
||||
-----------
|
||||
Logs both, the request and the response.
|
||||
|
||||
This directive is a combination of ``logRequest`` and ``logResult``. See ``logRequest`` for the general description
|
||||
how these directives work.
|
||||
This directive is a combination of :ref:`-logRequest-` and :ref:`-logResult-`.
|
||||
|
||||
See :ref:`-logRequest-` for the general description how these directives work.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
logResult
|
||||
=========
|
||||
|
||||
Logs the response.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -23,8 +21,9 @@ The signature shown is simplified, the real signature uses magnets. [1]_
|
|||
|
||||
Description
|
||||
-----------
|
||||
Logs the response.
|
||||
|
||||
See ``logRequest`` for the general description how these directives work. This directive is different
|
||||
See :ref:`-logRequest-` for the general description how these directives work. This directive is different
|
||||
as it requires a ``LoggingMagnet[Any => Unit]``. Instead of just logging ``HttpResponses``, ``logResult`` is able to
|
||||
log any :ref:`RouteResult` coming back from the inner route.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
handleExceptions
|
||||
================
|
||||
|
||||
Catches exceptions thrown by the inner route and handles them using the specified ``ExceptionHandler``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Catches exceptions thrown by the inner route and handles them using the specified ``ExceptionHandler``.
|
||||
|
||||
Using this directive is an alternative to using a global implicitly defined ``ExceptionHandler`` that
|
||||
applies to the complete route.
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
getFromBrowseableDirectories
|
||||
============================
|
||||
|
||||
Serves the content of the given directories as a file system browser,
|
||||
i.e. files are sent and directories served as *browsable* listings.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
getFromBrowseableDirectory
|
||||
==========================
|
||||
|
||||
Serves the content of the given directory as a file system browser,
|
||||
i.e. files are sent and directories served as *browsable* listings.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
getFromDirectory
|
||||
================
|
||||
|
||||
Completes GET requests with the content of a file underneath the given directory.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
getFromFile
|
||||
===========
|
||||
|
||||
Completes GET requests with the content of the given file.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
getFromResource
|
||||
===============
|
||||
|
||||
Completes GET requests with the content of the given classpath resource.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,7 +14,7 @@ Description
|
|||
|
||||
Completes GET requests with the content of the given classpath resource.
|
||||
|
||||
For details refer to :ref:`getFromFile` which works the same way but obtaining the file from the filesystem
|
||||
For details refer to :ref:`-getFromFile-` which works the same way but obtaining the file from the filesystem
|
||||
instead of the applications classpath.
|
||||
|
||||
Note that it's not required to wrap this directive with ``get`` as this directive will only respond to ``GET`` requests.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
getFromResourceDirectory
|
||||
========================
|
||||
|
||||
Completes GET requests with the content of the given classpath resource directory.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,7 +14,7 @@ Description
|
|||
|
||||
Completes GET requests with the content of the given classpath resource directory.
|
||||
|
||||
For details refer to :ref:`getFromDirectory` which works the same way but obtaining the file from the filesystem
|
||||
For details refer to :ref:`-getFromDirectory-` which works the same way but obtaining the file from the filesystem
|
||||
instead of the applications classpath.
|
||||
|
||||
Note that it's not required to wrap this directive with ``get`` as this directive will only respond to ``GET`` requests.
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
listDirectoryContents
|
||||
=====================
|
||||
|
||||
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]`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,11 +12,12 @@ Signature
|
|||
Description
|
||||
-----------
|
||||
|
||||
The ``listDirectoryContents`` directive renders a response only for 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]``.
|
||||
|
||||
To just serve files use :ref:`-getFromDirectory-`.
|
||||
|
||||
To serve files and provide a browseable directory listing use :ref:`-getFromBrowsableDirectories-` instead.
|
||||
To serve files and provide a browseable directory listing use :ref:`-getFromBrowseableDirectories-` instead.
|
||||
|
||||
The rendering can be overridden by providing a custom ``Marshaller[DirectoryListing]``, you can read more about it in
|
||||
:ref:`-getFromDirectory-` 's documentation.
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
formField
|
||||
=========
|
||||
|
||||
Allows extracting a single Form field sent in the request.
|
||||
|
||||
An alias for :ref:`-formFields-`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,8 +11,9 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Allows extracting a single Form field sent in the request.
|
||||
|
||||
See :ref:`-formFields-`.
|
||||
See :ref:`-formFields-` for an in-depth description.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
formFields
|
||||
==========
|
||||
|
||||
Extracts fields from POST requests generated by HTML forms.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -22,6 +20,7 @@ The signature shown is simplified and written in pseudo-syntax, the real signatu
|
|||
|
||||
Description
|
||||
-----------
|
||||
Extracts fields from POST requests generated by HTML forms.
|
||||
|
||||
Form fields can be either extracted as a String or can be converted to another type. The parameter name
|
||||
can be supplied either as a String or as a Symbol. Form field extraction can be modified to mark a field
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
completeOrRecoverWith
|
||||
=====================
|
||||
|
||||
Completes the request with the result of the computation given as argument of type ``Future[T]`` by marshalling it
|
||||
with the implicitly given ``ToResponseMarshaller[T]``. Runs the inner route if the ``Future`` computation fails.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,8 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
|
||||
If the future succeeds the request is completed using the value's marshaller (this directive therefore
|
||||
If the ``Future[T]`` succeeds the request is completed using the value's marshaller (this directive therefore
|
||||
requires a marshaller for the future's parameter type to be implicitly available). The execution of the inner
|
||||
route passed to this directive is only executed if the given future completed with a failure,
|
||||
exposing the reason of failure as a extraction of type ``Throwable``.
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
onComplete
|
||||
==========
|
||||
|
||||
Evaluates its parameter of type ``Future[T]``, and once the ``Future`` has been completed, extracts its
|
||||
result as a value of type ``Try[T]`` and passes it to the inner route.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,11 +11,11 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
|
||||
The evaluation of the inner route passed to a onComplete directive is deferred until the given future
|
||||
has completed and provided with a extraction of type ``Try[T]``.
|
||||
Evaluates its parameter of type ``Future[T]``, and once the ``Future`` has been completed, extracts its
|
||||
result as a value of type ``Try[T]`` and passes it to the inner route.
|
||||
|
||||
To handle the ``Failure`` case automatically and only work with the result value, use :ref:`-onSuccess-`.
|
||||
|
||||
To complete with a successful result automatically and just handle the failure result, use :ref:`-completeOrRecoverWith-`, instead.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
onSuccess
|
||||
=========
|
||||
|
||||
Evaluates its parameter of type ``Future[T]``, and once the ``Future`` has been completed successfully,
|
||||
extracts its result as a value of type ``T`` and passes it to the inner route.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,10 +11,10 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Evaluates its parameter of type ``Future[T]``, and once the ``Future`` has been completed successfully,
|
||||
extracts its result as a value of type ``T`` and passes it to the inner route.
|
||||
|
||||
The execution of the inner route passed to a onSuccess directive is deferred until the given future
|
||||
has completed successfully, exposing the future's value as a extraction of type ``T``. If the future
|
||||
fails its failure throwable is bubbled up to the nearest ``ExceptionHandler``.
|
||||
If the future fails its failure throwable is bubbled up to the nearest ``ExceptionHandler``.
|
||||
|
||||
To handle the ``Failure`` case manually as well, use :ref:`-onComplete-`, instead.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
headerValue
|
||||
===========
|
||||
|
||||
Traverses the list of request headers with the specified function and extracts the first value the function returns as
|
||||
``Some(value)``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,14 +11,17 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Traverses the list of request headers with the specified function and extracts the first value the function returns as
|
||||
``Some(value)``.
|
||||
|
||||
The ``headerValue`` directive is a mixture of ``map`` and ``find`` on the list of request headers. The specified function
|
||||
The :ref:`-headerValue-` directive is a mixture of ``map`` and ``find`` on the list of request headers. The specified function
|
||||
is called once for each header until the function returns ``Some(value)``. This value is extracted and presented to the
|
||||
inner route. If the function throws an exception the request is rejected with a ``MalformedHeaderRejection``. If the
|
||||
function returns ``None`` for every header the request is rejected as "NotFound".
|
||||
|
||||
This directive is the basis for building other request header related directives. See ``headerValuePF`` for a nicer
|
||||
syntactic alternative.
|
||||
This directive is the basis for building other request header related directives.
|
||||
|
||||
See also :ref:`-headerValuePF-` for a nicer syntactic alternative.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
headerValueByName
|
||||
=================
|
||||
|
||||
Extracts the value of the HTTP request header with the given name.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,9 +11,12 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Extracts the value of the HTTP request header with the given name.
|
||||
|
||||
The name can be given as a ``String`` or as a ``Symbol``. If no header with a matching name is found the request
|
||||
is rejected with a ``MissingHeaderRejection``. If the header is expected to be missing in some cases or to customize
|
||||
is rejected with a ``MissingHeaderRejection``.
|
||||
|
||||
If the header is expected to be missing in some cases or to customize
|
||||
handling when the header is missing use the :ref:`-optionalHeaderValueByName-` directive instead.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
headerValueByType
|
||||
=================
|
||||
|
||||
Traverses the list of request headers and extracts the first header of the given type.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -19,11 +17,13 @@ The signature shown is simplified, the real signature uses magnets. [1]_
|
|||
|
||||
Description
|
||||
-----------
|
||||
Traverses the list of request headers and extracts the first header of the given type.
|
||||
|
||||
The ``headerValueByType`` directive finds a header of the given type in the list of request header. If no header of
|
||||
the given type is found the request is rejected with a ``MissingHeaderRejection``. If the header is expected to be
|
||||
missing in some cases or to customize handling when the header is missing use the ``optionalHeaderValueByType``
|
||||
directive instead.
|
||||
the given type is found the request is rejected with a ``MissingHeaderRejection``.
|
||||
|
||||
If the header is expected to be missing in some cases or to customize handling when the header
|
||||
is missing use the :ref:`-optionalHeaderValueByType-` directive instead.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
headerValuePF
|
||||
=============
|
||||
|
||||
Calls the specified partial function with the first request header the function is ``isDefinedAt`` and extracts the
|
||||
result of calling the function.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,10 +11,14 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Calls the specified partial function with the first request header the function is ``isDefinedAt`` and extracts the
|
||||
result of calling the function.
|
||||
|
||||
The ``headerValuePF`` directive is an alternative syntax version of ``headerValue``. If the function throws an
|
||||
exception the request is rejected with a ``MalformedHeaderRejection``. If the function is not defined for
|
||||
any header the request is rejected as "NotFound".
|
||||
The ``headerValuePF`` directive is an alternative syntax version of :ref:`-headerValue-`.
|
||||
|
||||
If the function throws an exception the request is rejected with a ``MalformedHeaderRejection``.
|
||||
|
||||
If the function is not defined for any header the request is rejected as "NotFound".
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
optionalHeaderValue
|
||||
===================
|
||||
|
||||
Traverses the list of request headers with the specified function and extracts the first value the function returns as
|
||||
``Some(value)``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,8 +11,10 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Traverses the list of request headers with the specified function and extracts the first value the function returns as
|
||||
``Some(value)``.
|
||||
|
||||
The ``optionalHeaderValue`` directive is similar to the ``headerValue`` directive but always extracts an ``Option``
|
||||
The ``optionalHeaderValue`` directive is similar to the :ref:`-headerValue-` directive but always extracts an ``Option``
|
||||
value instead of rejecting the request if no matching header could be found.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
optionalHeaderValueByName
|
||||
=========================
|
||||
|
||||
Optionally extracts the value of the HTTP request header with the given name.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,8 +11,9 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Optionally extracts the value of the HTTP request header with the given name.
|
||||
|
||||
The ``optionalHeaderValueByName`` directive is similar to the ``headerValueByName`` directive but always extracts
|
||||
The ``optionalHeaderValueByName`` directive is similar to the :ref:`-headerValueByName-` directive but always extracts
|
||||
an ``Option`` value instead of rejecting the request if no matching header could be found.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
optionalHeaderValueByType
|
||||
=========================
|
||||
|
||||
Optionally extracts the value of the HTTP request header of the given type.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -19,8 +17,9 @@ The signature shown is simplified, the real signature uses magnets. [1]_
|
|||
|
||||
Description
|
||||
-----------
|
||||
Optionally extracts the value of the HTTP request header of the given type.
|
||||
|
||||
The ``optionalHeaderValueByType`` directive is similar to the ``headerValueByType`` directive but always extracts
|
||||
The ``optionalHeaderValueByType`` directive is similar to the :ref:`-headerValueByType-` directive but always extracts
|
||||
an ``Option`` value instead of rejecting the request if no matching header could be found.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
optionalHeaderValuePF
|
||||
=====================
|
||||
|
||||
Calls the specified partial function with the first request header the function is ``isDefinedAt`` and extracts the
|
||||
result of calling the function.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,8 +11,10 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Calls the specified partial function with the first request header the function is ``isDefinedAt`` and extracts the
|
||||
result of calling the function.
|
||||
|
||||
The ``optionalHeaderValuePF`` directive is similar to the ``headerValuePF`` directive but always extracts an ``Option``
|
||||
The ``optionalHeaderValuePF`` directive is similar to the :ref:`-headerValuePF-` directive but always extracts an ``Option``
|
||||
value instead of rejecting the request if no matching header could be found.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
extractHost
|
||||
===========
|
||||
|
||||
Extracts the hostname part of the Host header value in the request.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,8 +13,7 @@ Signature
|
|||
Description
|
||||
-----------
|
||||
|
||||
Extract the hostname part of the ``Host`` request header and expose it as a ``String`` extraction
|
||||
to its inner route.
|
||||
Extract the hostname part of the ``Host`` request header and expose it as a ``String`` extraction to its inner route.
|
||||
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
host
|
||||
====
|
||||
|
||||
Filter requests matching conditions against the hostname part of the Host header value
|
||||
in the request.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Filter requests matching conditions against the hostname part of the Host header value in the request.
|
||||
|
||||
The ``def host(hostNames: String*)`` overload rejects all requests with a hostname different from the given ones.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. _Directives:
|
||||
.. _directives:
|
||||
|
||||
Directives
|
||||
==========
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
completeWith
|
||||
============
|
||||
|
||||
Uses the marshaller for a given type to produce a completion function that is passed to its
|
||||
inner route. You can use it to decouple marshaller resolution from request completion.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,6 +11,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Uses the marshaller for a given type to produce a completion function that is passed to its
|
||||
inner route. You can use it to decouple marshaller resolution from request completion.
|
||||
|
||||
The ``completeWith`` directive works in conjuction with ``instanceOf`` and ``spray.httpx.marshalling``
|
||||
to convert higher-level (object) structure into some lower-level serialized "wire format".
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
entity
|
||||
======
|
||||
|
||||
Unmarshalls the request entity to the given type and passes it to its inner Route. An unmarshaller
|
||||
returns an ``Either`` with ``Right(value)`` if successful or ``Left(exception)`` for a failure.
|
||||
The ``entity`` method will either pass the ``value`` to the inner route or map the ``exception`` to a
|
||||
``akka.http.scaladsl.server.Rejection``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +11,10 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Unmarshalls the request entity to the given type and passes it to its inner Route. An unmarshaller
|
||||
returns an ``Either`` with ``Right(value)`` if successful or ``Left(exception)`` for a failure.
|
||||
The ``entity`` method will either pass the ``value`` to the inner route or map the ``exception`` to a
|
||||
``akka.http.scaladsl.server.Rejection``.
|
||||
|
||||
The ``entity`` directive works in conjuction with ``as`` and ``akka.http.scaladsl.unmarshalling`` to
|
||||
convert some serialized "wire format" value into a higher-level object structure.
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
handleWith
|
||||
==========
|
||||
|
||||
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. ``handleWith`` can be a convenient method combining ``entity`` with
|
||||
``complete``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,8 +11,12 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
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. ``handleWith`` can be a convenient method combining ``entity`` with
|
||||
``complete``.
|
||||
|
||||
The ``handleWith`` directive is used when you want to handle a route with a given function of
|
||||
The ``handleWith`` directive is used when you want to handle a route with a given function of
|
||||
type A ⇒ B. ``handleWith`` will use both an in-scope unmarshaller to convert a request into
|
||||
type A and an in-scope marshaller to convert type B into a response. This is helpful when your
|
||||
core business logic resides in some other class or you want your business logic to be independent
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
delete
|
||||
======
|
||||
|
||||
Matches requests with HTTP method ``DELETE``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,6 +12,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches requests with HTTP method ``DELETE``.
|
||||
|
||||
This directive filters an incoming request by its HTTP method. Only requests with
|
||||
method ``DELETE`` are passed on to the inner route. All others are rejected with a
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
extractMethod
|
||||
=============
|
||||
|
||||
Extracts the :class:`HttpMethod` from the request context which can be used programatically in a route.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,7 +11,6 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
|
||||
Extracts the :class:`HttpMethod` from the request context and provides it for use for other directives explicitly.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
get
|
||||
===
|
||||
|
||||
Matches requests with HTTP method ``GET``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches requests with HTTP method ``GET``.
|
||||
|
||||
This directive filters the incoming request by its HTTP method. Only requests with
|
||||
method ``GET`` are passed on to the inner route. All others are rejected with a
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
head
|
||||
====
|
||||
|
||||
Matches requests with HTTP method ``HEAD``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches requests with HTTP method ``HEAD``.
|
||||
|
||||
This directive filters the incoming request by its HTTP method. Only requests with
|
||||
method ``HEAD`` are passed on to the inner route. All others are rejected with a
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
method
|
||||
======
|
||||
|
||||
Matches HTTP requests based on their method.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches HTTP requests based on their method.
|
||||
|
||||
This directive filters the incoming request by its HTTP method. Only requests with
|
||||
the specified method are passed on to the inner route. All others are rejected with a
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
options
|
||||
=======
|
||||
|
||||
Matches requests with HTTP method ``OPTIONS``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches requests with HTTP method ``OPTIONS``.
|
||||
|
||||
This directive filters the incoming request by its HTTP method. Only requests with
|
||||
method ``OPTIONS`` are passed on to the inner route. All others are rejected with a
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
overrideMethodWithParameter
|
||||
===========================
|
||||
|
||||
Changes the request method to the value of the specified query parameter.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Changes the request method to the value of the specified query 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.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
patch
|
||||
=====
|
||||
|
||||
Matches requests with HTTP method ``PATCH``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches requests with HTTP method ``PATCH``.
|
||||
|
||||
This directive filters the incoming request by its HTTP method. Only requests with
|
||||
method ``PATCH`` are passed on to the inner route. All others are rejected with a
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
post
|
||||
====
|
||||
|
||||
Matches requests with HTTP method ``POST``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches requests with HTTP method ``POST``.
|
||||
|
||||
This directive filters the incoming request by its HTTP method. Only requests with
|
||||
method ``POST`` are passed on to the inner route. All others are rejected with a
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
put
|
||||
===
|
||||
|
||||
Matches requests with HTTP method ``PUT``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches requests with HTTP method ``PUT``.
|
||||
|
||||
This directive filters the incoming request by its HTTP method. Only requests with
|
||||
method ``PUT`` are passed on to the inner route. All others are rejected with a
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
extractClientIP
|
||||
===============
|
||||
|
||||
Provides the value of ``X-Forwarded-For``, ``Remote-Address``, or ``X-Real-IP`` headers as an instance of
|
||||
``HttpIp``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Provides the value of ``X-Forwarded-For``, ``Remote-Address``, or ``X-Real-IP`` headers as an instance of ``HttpIp``.
|
||||
|
||||
The akka-http server engine adds the ``Remote-Address`` header to every request automatically if the respective
|
||||
setting ``akka.http.server.remote-address-header`` is set to ``on``. Per default it is set to ``off``.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
rejectEmptyResponse
|
||||
===================
|
||||
|
||||
Replaces a response with no content with an empty rejection.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,6 +12,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Replaces a response with no content with an empty rejection.
|
||||
|
||||
The ``rejectEmptyResponse`` directive is mostly used with marshalling ``Option[T]`` instances. The value ``None`` is
|
||||
usually marshalled to an empty but successful result. In many cases ``None`` should instead be handled as
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
requestEntityEmpty
|
||||
==================
|
||||
|
||||
A filter that checks if the request entity is empty and only then passes processing to the inner route.
|
||||
Otherwise, the request is rejected.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,8 +12,11 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
A filter that checks if the request entity is empty and only then passes processing to the inner route.
|
||||
Otherwise, the request is rejected.
|
||||
|
||||
The opposite filter is available as ``requestEntityPresent``.
|
||||
|
||||
See also :ref:`-requestEntityPresent-` for the opposite effect.
|
||||
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
requestEntityPresent
|
||||
====================
|
||||
|
||||
A simple filter that checks if the request entity is present and only then passes processing to the inner route.
|
||||
Otherwise, the request is rejected.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,8 +12,10 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
A simple filter that checks if the request entity is present and only then passes processing to the inner route.
|
||||
Otherwise, the request is rejected.
|
||||
|
||||
The opposite filter is available as ``requestEntityEmpty``.
|
||||
See also :ref:`-requestEntityEmpty-` for the opposite effect.
|
||||
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
validate
|
||||
========
|
||||
|
||||
Allows validating a precondition before handling a route.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Allows validating a precondition before handling a route.
|
||||
|
||||
Checks an arbitrary condition and passes control to the inner route if it returns ``true``.
|
||||
Otherwise, rejects the request with a ``ValidationRejection`` containing the given error message.
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
parameter
|
||||
=========
|
||||
|
||||
Extracts a *query* parameter value from the request.
|
||||
|
||||
An alias for :ref:`-parameters-`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Extracts a *query* parameter value from the request.
|
||||
|
||||
See :ref:`-parameters-` for a detailed description of this directive.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
parameterMap
|
||||
============
|
||||
|
||||
Extracts all parameters at once as a ``Map[String, String]`` mapping parameter names to
|
||||
parameter values.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -14,10 +11,11 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Extracts all parameters at once as a ``Map[String, String]`` mapping parameter names to parameter values.
|
||||
|
||||
If a query contains a parameter value several times, the map will contain the last one.
|
||||
|
||||
See :ref:`which-parameter-directive` to understand when to use which directive.
|
||||
See also :ref:`which-parameter-directive` to understand when to use which directive.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
parameterMultiMap
|
||||
=================
|
||||
|
||||
Extracts all parameters at once as a multi-map of type ``Map[String, List[String]`` mapping
|
||||
a parameter name to a list of all its values.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,8 +12,12 @@ Signature
|
|||
Description
|
||||
-----------
|
||||
|
||||
This directive can be used if parameters can occur several times. The order of values is
|
||||
not specified.
|
||||
Extracts all parameters at once as a multi-map of type ``Map[String, List[String]`` mapping
|
||||
a parameter name to a list of all its values.
|
||||
|
||||
This directive can be used if parameters can occur several times.
|
||||
|
||||
The order of values is *not* specified.
|
||||
|
||||
See :ref:`which-parameter-directive` to understand when to use which directive.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
parameterSeq
|
||||
============
|
||||
|
||||
Extracts all parameters at once in the original order as (name, value) tuples of type ``(String, String)``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,11 +11,11 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Extracts all parameters at once in the original order as (name, value) tuples of type ``(String, String)``.
|
||||
|
||||
This directive can be used if the exact order of parameters is important or if parameters can
|
||||
occur several times.
|
||||
This directive can be used if the exact order of parameters is important or if parameters can occur several times.
|
||||
|
||||
See :ref:`which-parameter-directive` for other choices.
|
||||
See :ref:`which-parameter-directive` to understand when to use which directive.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
parameters
|
||||
==========
|
||||
|
||||
The parameters directive filters on the existence of several query parameters and extract their values.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -22,6 +20,8 @@ The signature shown is simplified and written in pseudo-syntax, the real signatu
|
|||
|
||||
Description
|
||||
-----------
|
||||
The parameters directive filters on the existence of several query parameters and extract their values.
|
||||
|
||||
Query parameters can be either extracted as a String or can be converted to another type. The parameter name
|
||||
can be supplied either as a String or as a Symbol. Parameter extraction can be modified to mark a query parameter
|
||||
as required, optional, or repeated, or to filter requests where a parameter has a certain value:
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
path
|
||||
====
|
||||
|
||||
Matches the complete unmatched path of the ``RequestContext`` against the given ``PathMatcher``, potentially extracts
|
||||
one or more values (depending on the type of the argument).
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches the complete unmatched path of the ``RequestContext`` against the given ``PathMatcher``, potentially extracts
|
||||
one or more values (depending on the type of the argument).
|
||||
|
||||
This directive filters incoming requests based on the part of their URI that hasn't been matched yet by other
|
||||
potentially existing :ref:`-pathPrefix-` directives on higher levels of the routing structure.
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
pathEnd
|
||||
=======
|
||||
|
||||
Only passes the request to its inner route if the unmatched path of the ``RequestContext`` is empty, i.e. the request
|
||||
path has been fully matched by a higher-level :ref:`-path-` or :ref:`-pathPrefix-` directive.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,9 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Only passes the request to its inner route if the unmatched path of the ``RequestContext`` is empty, i.e. the request
|
||||
path has been fully matched by a higher-level :ref:`-path-` or :ref:`-pathPrefix-` directive.
|
||||
|
||||
|
||||
This directive is a simple alias for ``rawPathPrefix(PathEnd)`` and is mostly used on an
|
||||
inner-level to discriminate "path already fully matched" from other alternatives (see the example below).
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
pathEndOrSingleSlash
|
||||
====================
|
||||
|
||||
Only passes the request to its inner route if the unmatched path of the ``RequestContext`` is either empty
|
||||
or contains only one single slash.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Only passes the request to its inner route if the unmatched path of the ``RequestContext`` is either empty
|
||||
or contains only one single slash.
|
||||
|
||||
This directive is a simple alias for ``rawPathPrefix(Slash.? ~ PathEnd)`` and is mostly used on an inner-level to
|
||||
discriminate "path already fully matched" from other alternatives (see the example below).
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
pathPrefix
|
||||
==========
|
||||
|
||||
Matches and consumes a prefix of the unmatched path of the ``RequestContext`` against the given ``PathMatcher``,
|
||||
potentially extracts one or more values (depending on the type of the argument).
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches and consumes a prefix of the unmatched path of the ``RequestContext`` against the given ``PathMatcher``,
|
||||
potentially extracts one or more values (depending on the type of the argument).
|
||||
|
||||
This directive filters incoming requests based on the part of their URI that hasn't been matched yet by other
|
||||
potentially existing ``pathPrefix`` or :ref:`-rawPathPrefix-` directives on higher levels of the routing structure.
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
pathPrefixTest
|
||||
==============
|
||||
|
||||
Checks whether the unmatched path of the ``RequestContext`` has a prefix matched by the given ``PathMatcher``.
|
||||
Potentially extracts one or more values (depending on the type of the argument) but doesn't consume its match from
|
||||
the unmatched path.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -17,6 +12,9 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Checks whether the unmatched path of the ``RequestContext`` has a prefix matched by the given ``PathMatcher``.
|
||||
Potentially extracts one or more values (depending on the type of the argument) but doesn't consume its match from
|
||||
the unmatched path.
|
||||
|
||||
This directive is very similar to the :ref:`-pathPrefix-` directive with the one difference that the path prefix
|
||||
it matched (if it matched) is *not* consumed. The unmatched path of the ``RequestContext`` is therefore left as
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
pathSingleSlash
|
||||
===============
|
||||
|
||||
Only passes the request to its inner route if the unmatched path of the ``RequestContext``
|
||||
contains exactly one single slash.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Only passes the request to its inner route if the unmatched path of the ``RequestContext``
|
||||
contains exactly one single slash.
|
||||
|
||||
This directive is a simple alias for ``pathPrefix(PathEnd)`` and is mostly used for matching requests to the root URI
|
||||
(``/``) on an inner-level to discriminate "all path segments matched" from other alternatives (see the example below).
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
pathSuffix
|
||||
==========
|
||||
|
||||
Matches and consumes a suffix of the unmatched path of the ``RequestContext`` against the given ``PathMatcher``,
|
||||
potentially extracts one or more values (depending on the type of the argument).
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches and consumes a suffix of the unmatched path of the ``RequestContext`` against the given ``PathMatcher``,
|
||||
potentially extracts one or more values (depending on the type of the argument).
|
||||
|
||||
This directive filters incoming requests based on the part of their URI that hasn't been matched yet by other
|
||||
potentially existing path matching directives on higher levels of the routing structure.
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
pathSuffixTest
|
||||
==============
|
||||
|
||||
Checks whether the unmatched path of the ``RequestContext`` has a suffix matched by the given ``PathMatcher``.
|
||||
Potentially extracts one or more values (depending on the type of the argument) but doesn't consume its match from
|
||||
the unmatched path.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -17,6 +12,9 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Checks whether the unmatched path of the ``RequestContext`` has a suffix matched by the given ``PathMatcher``.
|
||||
Potentially extracts one or more values (depending on the type of the argument) but doesn't consume its match from
|
||||
the unmatched path.
|
||||
|
||||
This directive is very similar to the :ref:`-pathSuffix-` directive with the one difference that the path suffix
|
||||
it matched (if it matched) is *not* consumed. The unmatched path of the ``RequestContext`` is therefore left as
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
rawPathPrefix
|
||||
=============
|
||||
|
||||
Matches and consumes a prefix of the unmatched path of the ``RequestContext`` against the given ``PathMatcher``,
|
||||
potentially extracts one or more values (depending on the type of the argument).
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Matches and consumes a prefix of the unmatched path of the ``RequestContext`` against the given ``PathMatcher``,
|
||||
potentially extracts one or more values (depending on the type of the argument).
|
||||
|
||||
This directive filters incoming requests based on the part of their URI that hasn't been matched yet by other
|
||||
potentially existing ``rawPathPrefix`` or :ref:`-pathPrefix-` directives on higher levels of the routing structure.
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
rawPathPrefixTest
|
||||
=================
|
||||
|
||||
Checks whether the unmatched path of the ``RequestContext`` has a prefix matched by the given ``PathMatcher``.
|
||||
Potentially extracts one or more values (depending on the type of the argument) but doesn't consume its match from
|
||||
the unmatched path.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -17,6 +12,9 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Checks whether the unmatched path of the ``RequestContext`` has a prefix matched by the given ``PathMatcher``.
|
||||
Potentially extracts one or more values (depending on the type of the argument) but doesn't consume its match from
|
||||
the unmatched path.
|
||||
|
||||
This directive is very similar to the :ref:`-pathPrefix-` directive with the one difference that the path prefix
|
||||
it matched (if it matched) is *not* consumed. The unmatched path of the ``RequestContext`` is therefore left as
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
redirectToNoTrailingSlashIfPresent
|
||||
==================================
|
||||
|
||||
If the requested path does end with a trailing ``/`` character,
|
||||
redirects to the same path without that trailing slash..
|
||||
|
||||
Opposite of :ref:`-redirectToTrailingSlashIfMissing-`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +11,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
If the requested path does end with a trailing ``/`` character,
|
||||
redirects to the same path without that trailing slash..
|
||||
|
||||
Redirects the HTTP Client to the same resource yet without the trailing ``/``, in case the request contained it.
|
||||
When redirecting an HttpResponse with the given redirect response code (i.e. ``MovedPermanently`` or ``TemporaryRedirect``
|
||||
|
|
@ -27,6 +24,8 @@ for the re-directed-to route to match.
|
|||
|
||||
A good read on the subject of how to deal with trailing slashes is available on `Google Webmaster Central - To Slash or not to Slash`_.
|
||||
|
||||
See also :ref:`-redirectToTrailingSlashIfMissing-` for the opposite behaviour.
|
||||
|
||||
.. _Google Webmaster Central - To Slash or not to Slash: http://googlewebmastercentral.blogspot.de/2010/04/to-slash-or-not-to-slash.html
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
redirectToTrailingSlashIfMissing
|
||||
================================
|
||||
|
||||
If the requested path does not end with a trailing ``/`` character,
|
||||
redirects to the same path followed by such trailing slash.
|
||||
|
||||
Opposite of :ref:`-redirectToNoTrailingSlashIfPresent-`.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +11,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
If the requested path does not end with a trailing ``/`` character,
|
||||
redirects to the same path followed by such trailing slash.
|
||||
|
||||
Redirects the HTTP Client to the same resource yet followed by a trailing ``/``, in case the request did not contain it.
|
||||
When redirecting an HttpResponse with the given redirect response code (i.e. ``MovedPermanently`` or ``TemporaryRedirect``
|
||||
|
|
@ -25,6 +22,8 @@ or refuses to for security reasons, automatically follow redirects.
|
|||
Please note that the inner paths **MUST** end with an explicit trailing slash (e.g. ``"things"./``) for the
|
||||
re-directed-to route to match.
|
||||
|
||||
See also :ref:`-redirectToNoTrailingSlashIfPresent-` for the opposite behaviour.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
withRangeSupport
|
||||
================
|
||||
|
||||
Transforms the response from its inner route into a ``206 Partial Content``
|
||||
response if the client requested only part of the resource with a ``Range`` header.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -23,6 +19,8 @@ The signature shown is simplified, the real signature uses magnets. [1]_
|
|||
|
||||
Description
|
||||
-----------
|
||||
Transforms the response from its inner route into a ``206 Partial Content``
|
||||
response if the client requested only part of the resource with a ``Range`` header.
|
||||
|
||||
Augments responses to ``GET`` requests with an ``Accept-Ranges: bytes`` header and converts them into partial responses
|
||||
if the request contains a valid ``Range`` request header. The requested byte-ranges are coalesced (merged) if they
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
respondWithDefaultHeader
|
||||
========================
|
||||
|
||||
Adds a given HTTP header to all responses coming back from its inner route only if a header with the same name doesn't
|
||||
exist yet in the response.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,14 +12,16 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Adds a given HTTP header to all responses coming back from its inner route only if a header with the same name doesn't
|
||||
exist yet in the response.
|
||||
|
||||
|
||||
This directive transforms ``HttpResponse`` and ``ChunkedResponseStart`` messages coming back from its inner route by
|
||||
potentially adding the given ``HttpHeader`` instance to the headers list.
|
||||
The header is only added if there is no header instance with the same name (case insensitively) already present in the
|
||||
response.
|
||||
|
||||
If you'd like to add more than one header you can use the :ref:`-respondWithDefaultHeaders-` directive instead.
|
||||
|
||||
See also :ref:`-respondWithDefaultHeaders-` if you'd like to add more than one header.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
respondWithDefaultHeaders
|
||||
=========================
|
||||
|
||||
Adds the given HTTP headers to all responses coming back from its inner route only if a respective header with the same
|
||||
name doesn't exist yet in the response.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,11 +12,16 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Adds the given HTTP headers to all responses coming back from its inner route only if a respective header with the same
|
||||
name doesn't exist yet in the response.
|
||||
|
||||
|
||||
This directive transforms ``HttpResponse`` and ``ChunkedResponseStart`` messages coming back from its inner route by
|
||||
potentially adding the given ``HttpHeader`` instances to the headers list.
|
||||
A header is only added if there is no header instance with the same name (case insensitively) already present in the
|
||||
response. If you'd like to add only a single header you can use the :ref:`-respondWithDefaultHeader-` directive instead.
|
||||
response.
|
||||
|
||||
See also :ref:`-respondWithDefaultHeader-` if you'd like to add only a single header.
|
||||
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
respondWithHeader
|
||||
=================
|
||||
|
||||
Adds a given HTTP header to all responses coming back from its inner route.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,11 +12,12 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Adds a given HTTP header to all responses coming back from its inner route.
|
||||
|
||||
This directive transforms ``HttpResponse`` and ``ChunkedResponseStart`` messages coming back from its inner route by
|
||||
adding the given ``HttpHeader`` instance to the headers list.
|
||||
If you'd like to add more than one header you can use the :ref:`-respondWithHeaders-` directive instead.
|
||||
|
||||
See also :ref:`-respondWithHeaders-` if you'd like to add more than one header.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
respondWithHeaders
|
||||
==================
|
||||
|
||||
Adds the given HTTP headers to all responses coming back from its inner route.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,10 +12,12 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Adds the given HTTP headers to all responses coming back from its inner route.
|
||||
|
||||
This directive transforms ``HttpResponse`` and ``ChunkedResponseStart`` messages coming back from its inner route by
|
||||
adding the given ``HttpHeader`` instances to the headers list.
|
||||
If you'd like to add just a single header you can use the :ref:`-respondWithHeader-` directive instead.
|
||||
|
||||
See also :ref:`-respondWithHeader-` if you'd like to add just a single header.
|
||||
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
complete
|
||||
========
|
||||
|
||||
Completes the request using the given argument(s).
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -27,6 +24,8 @@ The signature shown is simplified, the real signature uses magnets. [1]_
|
|||
Description
|
||||
-----------
|
||||
|
||||
Completes the request using the given argument(s).
|
||||
|
||||
``complete`` uses the given arguments to construct a ``Route`` which simply calls ``complete`` on the ``RequestContext``
|
||||
with the respective ``HttpResponse`` instance.
|
||||
Completing the request will send the response "back up" the route structure where all the logic runs that wrapping
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
failWith
|
||||
========
|
||||
|
||||
Bubbles up the given error through the route structure where it is dealt with by the closest ``handleExceptions``
|
||||
directive and its :class:`ExceptionHandler`.
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -16,6 +12,8 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Bubbles up the given error through the route structure where it is dealt with by the closest ``handleExceptions``
|
||||
directive and its :class:`ExceptionHandler`.
|
||||
|
||||
``failWith`` explicitly raises an exception that gets bubbled up through the route structure to be picked up by the
|
||||
nearest ``handleExceptions`` directive. Using ``failWith`` rather than simply throwing an exception enables the route
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
redirect
|
||||
========
|
||||
|
||||
Completes the request with a redirection response to a given targer URI and of a given redirection type (status code).
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +12,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Completes the request with a redirection response to a given targer URI and of a given redirection type (status code).
|
||||
|
||||
``redirect`` is a convenience helper for completing the request with a redirection response.
|
||||
It is equivalent to this snippet relying on the ``complete`` directive:
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
reject
|
||||
======
|
||||
|
||||
Explicitly rejects the request optionally using the given rejection(s).
|
||||
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +12,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Explicitly rejects the request optionally using the given rejection(s).
|
||||
|
||||
``reject`` uses the given rejection instances (which might be the empty ``Seq``) to construct a ``Route`` which simply
|
||||
calls ``requestContext.reject``. See the chapter on :ref:`rejections-scala` for more information on what this means.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
extractScheme
|
||||
=============
|
||||
|
||||
Extracts the value of the request Uri scheme.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,9 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
|
||||
The ``extractScheme`` directive can be used to determine the Uri scheme (i.e. "http", "https", etc.)
|
||||
for an incoming request.
|
||||
Extracts the Uri scheme (i.e. "``http``", "``https``", etc.) for an incoming request.
|
||||
|
||||
For rejecting a request if it doesn't match a specified scheme name, see the :ref:`-scheme-` directive.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
scheme
|
||||
======
|
||||
|
||||
Rejects a request if its Uri scheme does not match a given one.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Rejects a request if its Uri scheme does not match a given one.
|
||||
|
||||
The ``scheme`` directive can be used to match requests by their Uri scheme, only passing
|
||||
through requests that match the specified scheme and rejecting all others.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
authenticateBasic
|
||||
=================
|
||||
|
||||
Wraps the inner route with Http Basic authentication support using a given ``Authenticator[T]``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +13,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Wraps the inner route with Http Basic authentication support using a given ``Authenticator[T]``.
|
||||
|
||||
Provides support for handling `HTTP Basic Authentication`_.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
authenticateBasicAsync
|
||||
======================
|
||||
|
||||
Wraps the inner route with Http Basic authentication support using a given ``AsyncAuthenticator[T]``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,8 +13,9 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Wraps the inner route with Http Basic authentication support using a given ``AsyncAuthenticator[T]``.
|
||||
|
||||
This variant of the :ref:`authenticateBasic` directive returns a ``Future[Option[T]]`` which allows freeing up the routing
|
||||
This variant of the :ref:`-authenticateBasic-` directive returns a ``Future[Option[T]]`` which allows freeing up the routing
|
||||
layer of Akka HTTP, freeing it for other requests. It should be used whenever an authentication is expected to take
|
||||
a longer amount of time (e.g. looking up the user in a database).
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
authenticateBasicPF
|
||||
===================
|
||||
|
||||
Wraps the inner route with Http Basic authentication support using a given ``AuthenticatorPF[T]``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +13,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Wraps the inner route with Http Basic authentication support using a given ``AuthenticatorPF[T]``.
|
||||
|
||||
Provides support for handling `HTTP Basic Authentication`_.
|
||||
|
||||
|
|
@ -23,7 +22,7 @@ Refer to :ref:`-authenticateBasic-` for a detailed description of this directive
|
|||
Its semantics are equivalent to ``authenticateBasicPF`` 's, where not handling a case in the Partial Function (PF)
|
||||
leaves the request to be rejected with a :class:`AuthenticationFailedRejection` rejection.
|
||||
|
||||
Longer-running authentication tasks (like looking up credentials in a database) should use :ref:`authenticateBasicAsync`
|
||||
Longer-running authentication tasks (like looking up credentials in a database) should use :ref:`-authenticateBasicAsync-`
|
||||
or :ref:`-authenticateBasicPFAsync-` if you prefer to use the ``PartialFunction`` syntax.
|
||||
|
||||
.. warning::
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
authenticateBasicPFAsync
|
||||
========================
|
||||
|
||||
Wraps the inner route with Http Basic authentication support using a given ``AsyncAuthenticatorPF[T]``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +13,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Wraps the inner route with Http Basic authentication support using a given ``AsyncAuthenticatorPF[T]``.
|
||||
|
||||
Provides support for handling `HTTP Basic Authentication`_.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
authenticateOAuth2
|
||||
==================
|
||||
|
||||
Wraps the inner route with OAuth Bearer Token authentication support using a given ``AuthenticatorPF[T]``
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +13,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Wraps the inner route with OAuth Bearer Token authentication support using a given ``AuthenticatorPF[T]``
|
||||
|
||||
Provides support for extracting the so-called "*Bearer Token*" from the :class:`Authorization` HTTP Header,
|
||||
which is used to initiate an OAuth2 authorization.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
authenticateOAuth2Async
|
||||
=======================
|
||||
|
||||
Wraps the inner route with OAuth Bearer Token authentication support using a given ``AsyncAuthenticator[T]``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +13,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Wraps the inner route with OAuth Bearer Token authentication support using a given ``AsyncAuthenticator[T]``.
|
||||
|
||||
Provides support for extracting the so-called "*Bearer Token*" from the :class:`Authorization` HTTP Header,
|
||||
which is used to initiate an OAuth2 authorization.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
authenticateOAuth2PF
|
||||
====================
|
||||
|
||||
Wraps the inner route with OAuth Bearer Token authentication support using a given ``AuthenticatorPF[T]``.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +13,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Wraps the inner route with OAuth Bearer Token authentication support using a given ``AuthenticatorPF[T]``.
|
||||
|
||||
Provides support for extracting the so-called "*Bearer Token*" from the :class:`Authorization` HTTP Header,
|
||||
which is used to initiate an OAuth2 authorization.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
.. _-authenticateOAuth2AsyncPF-:
|
||||
.. _-authenticateOAuth2PFAsync-:
|
||||
|
||||
authenticateOAuth2AsyncPF
|
||||
authenticateOAuth2PFAsync
|
||||
=========================
|
||||
|
||||
Wraps the inner route with OAuth Bearer Token authentication support using a given ``AsyncAuthenticatorPF[T]``.
|
||||
|
|
@ -11,7 +11,7 @@ Signature
|
|||
.. includecode:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/SecurityDirectives.scala#authenticator
|
||||
|
||||
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/SecurityDirectives.scala
|
||||
:snippet: authenticateOAuth2AsyncPF
|
||||
:snippet: authenticateOAuth2PFAsync
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
@ -38,5 +38,5 @@ For more information on how OAuth2 works see `RFC 6750`_.
|
|||
Example
|
||||
-------
|
||||
|
||||
Usage in code is exactly the same as :ref:`-authenticateBasicAsyncPF-`,
|
||||
Usage in code is exactly the same as :ref:`-authenticateBasicPFAsync-`,
|
||||
with the difference that one must validate the token as OAuth2 dictates (which is currently not part of Akka HTTP itself).
|
||||
|
|
@ -3,8 +3,6 @@
|
|||
authenticateOrRejectWithChallenge
|
||||
=================================
|
||||
|
||||
Lifts an authenticator function into a directive.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -15,6 +13,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Lifts an authenticator function into a directive.
|
||||
|
||||
This directive allows implementing the low level challange-response type of authentication that some services may require.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
authorize
|
||||
=========
|
||||
|
||||
Applies the given authorization check to the request.
|
||||
|
||||
Signature
|
||||
---------
|
||||
|
||||
|
|
@ -13,6 +11,7 @@ Signature
|
|||
|
||||
Description
|
||||
-----------
|
||||
Applies the given authorization check to the request.
|
||||
|
||||
The user-defined authorization check can either be supplied as a ``=> Boolean`` value which is calculated
|
||||
just from information out of the lexical scope, or as a function ``RequestContext => Boolean`` which can also
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue