pekko/akka-docs/rst/java/http/routing-dsl/directives/coding-directives/encodeResponse.rst

20 lines
698 B
ReStructuredText

.. _-encodeResponse-java-:
encodeResponse
==============
Description
-----------
Encodes the response with the encoding that is requested by the client via the ``Accept-Encoding`` header or rejects the request with an ``UnacceptedResponseEncodingRejection(supportedEncodings)``.
The response encoding is determined by the rules specified in RFC7231_.
If the ``Accept-Encoding`` header is missing or empty or specifies an encoding other than identity, gzip or deflate then no encoding is used.
Example
-------
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/CodingDirectivesExamplesTest.java#encodeResponse
.. _RFC7231: http://tools.ietf.org/html/rfc7231#section-5.3.4