2015-05-11 23:05:18 +02:00
|
|
|
.. _-reject-:
|
|
|
|
|
|
|
|
|
|
reject
|
|
|
|
|
======
|
|
|
|
|
|
|
|
|
|
Signature
|
|
|
|
|
---------
|
|
|
|
|
|
2015-06-19 15:35:24 +02:00
|
|
|
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/RouteDirectives.scala
|
2015-05-11 23:05:18 +02:00
|
|
|
:snippet: reject
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
|
-----------
|
2015-10-09 15:19:36 +02:00
|
|
|
Explicitly rejects the request optionally using the given rejection(s).
|
2015-05-11 23:05:18 +02:00
|
|
|
|
|
|
|
|
``reject`` uses the given rejection instances (which might be the empty ``Seq``) to construct a ``Route`` which simply
|
2015-10-08 16:26:29 +02:00
|
|
|
calls ``requestContext.reject``. See the chapter on :ref:`rejections-scala` for more information on what this means.
|
2015-05-11 23:05:18 +02:00
|
|
|
|
|
|
|
|
After the request has been rejected at the respective point it will continue to flow through the routing structure in
|
|
|
|
|
the search for a route that is able to complete it.
|
|
|
|
|
|
|
|
|
|
The explicit ``reject`` directive is used mostly when building :ref:`Custom Directives`, e.g. inside of a ``flatMap``
|
|
|
|
|
modifier for "filtering out" certain cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
-------
|
|
|
|
|
|
2015-09-16 23:50:35 +02:00
|
|
|
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/RouteDirectivesExamplesSpec.scala
|
2015-05-11 23:05:18 +02:00
|
|
|
:snippet: reject-examples
|