+htp #20881 add toStrictEntity and extractStrictEntity directive (#20953)

This commit is contained in:
Hawstein 2016-07-22 17:33:30 +08:00 committed by Konrad Malawski
parent e0d73187bd
commit 6fb2d176a1
10 changed files with 279 additions and 1 deletions

View file

@ -0,0 +1,23 @@
.. _-extractStrictEntity-java-:
extractStrictEntity
===================
Description
-----------
Extracts the strict http entity as ``HttpEntity.Strict`` from the :class:`RequestContext`.
A timeout parameter is given and if the stream isn't completed after the timeout, the directive will be failed.
.. warning::
The directive will read the request entity into memory within the size limit(8M by default) and effectively disable streaming.
The size limit can be configured globally with ``akka.http.parsing.max-content-length`` or
overridden by wrapping with :ref:`-withSizeLimit-java-` or :ref:`-withoutSizeLimit-java-` directive.
Example
-------
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/BasicDirectivesExamplesTest.java#extractStrictEntity

View file

@ -19,6 +19,7 @@ a single value or a tuple of values.
* :ref:`-extract-java-`
* :ref:`-extractExecutionContext-java-`
* :ref:`-extractMaterializer-java-`
* :ref:`-extractStrictEntity-java-`
* :ref:`-extractLog-java-`
* :ref:`-extractRequest-java-`
* :ref:`-extractRequestContext-java-`
@ -41,6 +42,7 @@ Transforming the Request(Context)
* :ref:`-withMaterializer-java-`
* :ref:`-withLog-java-`
* :ref:`-withSettings-java-`
* :ref:`-toStrictEntity-java-`
.. _Response Transforming Directives-java:
@ -93,6 +95,7 @@ Alphabetically
extract
extractExecutionContext
extractMaterializer
extractStrictEntity
extractLog
extractRequest
extractRequestContext
@ -117,6 +120,7 @@ Alphabetically
provide
recoverRejections
recoverRejectionsWith
toStrictEntity
withExecutionContext
withMaterializer
withLog

View file

@ -0,0 +1,23 @@
.. _-toStrictEntity-java-:
toStrictEntity
==============
Description
-----------
Transforms the request entity to strict entity before it is handled by the inner route.
A timeout parameter is given and if the stream isn't completed after the timeout, the directive will be failed.
.. warning::
The directive will read the request entity into memory within the size limit(8M by default) and effectively disable streaming.
The size limit can be configured globally with ``akka.http.parsing.max-content-length`` or
overridden by wrapping with :ref:`-withSizeLimit-java-` or :ref:`-withoutSizeLimit-java-` directive.
Example
-------
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/BasicDirectivesExamplesTest.java#toStrictEntity