23 lines
850 B
ReStructuredText
23 lines
850 B
ReStructuredText
.. _-mapResponse-java-:
|
|
|
|
mapResponse
|
|
===========
|
|
|
|
Description
|
|
-----------
|
|
|
|
The ``mapResponse`` directive is used as a building block for :ref:`Custom Directives-java` to transform a response that
|
|
was generated by the inner route. This directive transforms complete responses.
|
|
|
|
See also :ref:`-mapResponseHeaders-java-` or :ref:`-mapResponseEntity-java-` for more specialized variants and
|
|
:ref:`Response Transforming Directives-java` for similar directives.
|
|
|
|
Example: Override status
|
|
------------------------
|
|
|
|
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/BasicDirectivesExamplesTest.java#mapResponse
|
|
|
|
Example: Default to empty JSON response on errors
|
|
-------------------------------------------------
|
|
|
|
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/BasicDirectivesExamplesTest.java#mapResponse-advanced
|