pekko/akka-docs/rst/scala/http/routing-dsl/directives/basic-directives/extractRequestContext.rst
2016-01-14 00:31:03 +01:00

27 lines
825 B
ReStructuredText

.. _-extractRequestContext-:
extractRequestContext
=====================
Signature
---------
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/BasicDirectives.scala
:snippet: extractRequestContext
Description
-----------
Extracts the request's underlying :class:`RequestContext`.
This directive is used as a building block for most of the other directives,
which extract the context and by inspecting some of it's values can decide
what to do with the request - for example provide a value, or reject the request.
See also :ref:`-extractRequest-` if only interested in the :class:`HttpRequest` instance itself.
Example
-------
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/BasicDirectivesExamplesSpec.scala
:snippet: extractRequestContext-example