2014-12-18 09:25:33 +01:00
|
|
|
.. _-extract-:
|
|
|
|
|
|
|
|
|
|
extract
|
|
|
|
|
=======
|
|
|
|
|
|
|
|
|
|
Calculates a value from the request context and provides the value to the inner route.
|
|
|
|
|
|
|
|
|
|
Signature
|
|
|
|
|
---------
|
|
|
|
|
|
2015-05-11 23:05:18 +02:00
|
|
|
.. includecode2:: /../../akka-http-scala/src/main/scala/akka/http/scaladsl/server/directives/BasicDirectives.scala
|
2014-12-18 09:25:33 +01:00
|
|
|
:snippet: extract
|
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
The ``extract`` directive is used as a building block for :ref:`Custom Directives` to extract data from the
|
|
|
|
|
``RequestContext`` and provide it to the inner route. It is a special case for extracting one value of the more
|
|
|
|
|
general :ref:`-textract-` directive that can be used to extract more than one value.
|
|
|
|
|
|
|
|
|
|
See :ref:`ProvideDirectives` for an overview of similar directives.
|
|
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
-------
|
|
|
|
|
|
2015-05-11 23:05:18 +02:00
|
|
|
... includecode2:: ../../../../code/docs/http/scaladsl/server/directives/BasicDirectivesExamplesSpec.scala
|
2014-12-18 09:25:33 +01:00
|
|
|
:snippet: 0extract
|