pekko/akka-docs/rst/java/http/routing-dsl/directives/range-directives/withRangeSupport.rst
gosubpl b6f6438e96 doc #20466 Java range-directives examples added (#20892)
* #20466 Java range-directives examples added

* #20466 post-review changes
2016-07-06 23:23:45 +02:00

31 lines
No EOL
1.3 KiB
ReStructuredText

.. _-withRangeSupport-java-:
withRangeSupport
================
Description
-----------
Transforms the response from its inner route into a ``206 Partial Content``
response if the client requested only part of the resource with a ``Range`` header.
Augments responses to ``GET`` requests with an ``Accept-Ranges: bytes`` header and converts them into partial responses
if the request contains a valid ``Range`` request header. The requested byte-ranges are coalesced (merged) if they
lie closer together than the specified ``rangeCoalescingThreshold`` argument.
In order to prevent the server from becoming overloaded with trying to prepare ``multipart/byteranges`` responses for
high numbers of potentially very small ranges the directive rejects requests requesting more than ``rangeCountLimit``
ranges with a ``TooManyRangesRejection``.
Requests with unsatisfiable ranges are rejected with an ``UnsatisfiableRangeRejection``.
The ``withRangeSupport()`` form (without parameters) uses the ``range-coalescing-threshold`` and ``range-count-limit``
settings from the ``akka.http.routing`` configuration.
This directive is transparent to non-``GET`` requests.
See also: https://tools.ietf.org/html/rfc7233
Example
-------
.. includecode2:: ../../../../code/docs/http/javadsl/server/directives/RangeDirectivesExamplesTest.java
:snippet: withRangeSupport