2015-05-11 23:05:18 +02:00
|
|
|
.. _-complete-:
|
|
|
|
|
|
|
|
|
|
complete
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
Completes the request using the given argument(s).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Signature
|
|
|
|
|
---------
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
|
|
def complete[T :ToResponseMarshaller](value: T): StandardRoute
|
|
|
|
|
def complete(response: HttpResponse): StandardRoute
|
|
|
|
|
def complete(status: StatusCode): StandardRoute
|
|
|
|
|
def complete[T :Marshaller](status: StatusCode, value: T): StandardRoute
|
|
|
|
|
def complete[T :Marshaller](status: Int, value: T): StandardRoute
|
|
|
|
|
def complete[T :Marshaller](status: StatusCode, headers: Seq[HttpHeader], value: T): StandardRoute
|
|
|
|
|
def complete[T :Marshaller](status: Int, headers: Seq[HttpHeader], value: T): StandardRoute
|
|
|
|
|
|
|
|
|
|
The signature shown is simplified, the real signature uses magnets. [1]_
|
|
|
|
|
|
2015-05-21 13:14:54 +02:00
|
|
|
.. [1] See `The Magnet Pattern <http://spray.io/blog/2012-12-13-the-magnet-pattern/>`_ for an explanation of magnet-based overloading.
|
2015-05-11 23:05:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
``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
|
|
|
|
|
directives have potentially chained into the :ref:`RouteResult` future transformation chain.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
-------
|
|
|
|
|
|
|
|
|
|
... includecode2:: ../../../../code/docs/http/scaladsl/server/directives/RouteDirectivesExamplesSpec.scala
|
|
|
|
|
:snippet: complete-examples
|