withSizeLimit and withoutSizeLimit directives added
This commit is contained in:
parent
e00a86271a
commit
72f8544efd
15 changed files with 487 additions and 1 deletions
|
|
@ -139,6 +139,7 @@ Directive Description
|
|||
:ref:`-uploadedFile-java-` Streams one uploaded file from a multipart request to a file on disk
|
||||
:ref:`-validate-java-` Checks a given condition before running its inner route
|
||||
:ref:`-withoutRequestTimeout-java-` Disables :ref:`request timeouts <request-timeout-java>` for a given route.
|
||||
:ref:`-withoutSizeLimit-java-` Skips request entity size check
|
||||
:ref:`-withExecutionContext-java-` Runs its inner route with the given alternative ``ExecutionContext``
|
||||
:ref:`-withMaterializer-java-` Runs its inner route with the given alternative ``Materializer``
|
||||
:ref:`-withLog-java-` Runs its inner route with the given alternative ``LoggingAdapter``
|
||||
|
|
@ -146,5 +147,6 @@ Directive Description
|
|||
:ref:`-withRequestTimeout-java-` Configures the :ref:`request timeouts <request-timeout-java>` for a given route.
|
||||
:ref:`-withRequestTimeoutResponse-java-` Prepares the ``HttpResponse`` that is emitted if a request timeout is triggered. ``RequestContext => RequestContext`` function
|
||||
:ref:`-withSettings-java-` Runs its inner route with the given alternative ``RoutingSettings``
|
||||
:ref:`-withSizeLimit-java-` Applies request entity size check
|
||||
================================================ ============================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,5 @@ MiscDirectives
|
|||
requestEntityPresent
|
||||
selectPreferredLanguage
|
||||
validate
|
||||
withoutSizeLimit
|
||||
withSizeLimit
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
.. _-withSizeLimit-java-:
|
||||
|
||||
withSizeLimit
|
||||
===============
|
||||
|
||||
Description
|
||||
-----------
|
||||
Fails the stream with ``EntityStreamSizeException`` if its request entity size exceeds given limit. Limit given
|
||||
as parameter overrides limit configured with ``akka.http.parsing.max-content-length``.
|
||||
|
||||
The whole mechanism of entity size checking is intended to prevent certain Denial-of-Service attacks.
|
||||
So suggested setup is to have ``akka.http.parsing.max-content-length`` relatively low and use ``withSizeLimit``
|
||||
directive for endpoints which expects bigger entities.
|
||||
|
||||
See also :ref:`-withoutSizeLimit-java-` for skipping request entity size check.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/MiscDirectivesExamplesTest.java#withSizeLimitExample
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
.. _-withoutSizeLimit-java-:
|
||||
|
||||
withoutSizeLimit
|
||||
================
|
||||
|
||||
Description
|
||||
-----------
|
||||
Skips request entity size verification.
|
||||
|
||||
The whole mechanism of entity size checking is intended to prevent certain Denial-of-Service attacks.
|
||||
So suggested setup is to have ``akka.http.parsing.max-content-length`` relatively low and use ``withoutSizeLimit``
|
||||
directive just for endpoints for which size verification should not be performed.
|
||||
|
||||
See also :ref:`-withSizeLimit-java-` for setting request entity size limit.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/MiscDirectivesExamplesTest.java#withSizeLimitExample
|
||||
Loading…
Add table
Add a link
Reference in a new issue