From 03335592f8fa49c7de14367a9a5ccbb902e7cc09 Mon Sep 17 00:00:00 2001 From: jansupol Date: Tue, 7 May 2024 12:49:36 +0200 Subject: [PATCH] Document Multipart Configuration. Allow to limit the number of parts in the multipart entity. Signed-off-by: jansupol --- docs/src/main/docbook/appendix-properties.xml | 76 ++++++++++++++++++ docs/src/main/docbook/jersey.ent | 7 +- docs/src/main/docbook/media.xml | 21 ++++- .../media/multipart/MultiPartProperties.java | 54 ++++++++++++- .../internal/MultiPartReaderClientSide.java | 14 +++- .../multipart/internal/RestrictionsTest.java | 79 +++++++++++++++++++ 6 files changed, 243 insertions(+), 8 deletions(-) create mode 100644 media/multipart/src/test/java/org/glassfish/jersey/media/multipart/internal/RestrictionsTest.java diff --git a/docs/src/main/docbook/appendix-properties.xml b/docs/src/main/docbook/appendix-properties.xml index b3a58aad99..6f5036b779 100644 --- a/docs/src/main/docbook/appendix-properties.xml +++ b/docs/src/main/docbook/appendix-properties.xml @@ -2175,4 +2175,80 @@ +
+ Multipart configuration properties + + + List of multipart configuration properties that can be found in &jersey.media.multipart.MultiPartProperties; class. + + + + + List of multipart configuration properties settable in the + &jersey.media.multipart.MultiPartProperties.MULTI_PART_CONFIG_RESOURCE; configuration file. + + + + + Constant + Value + Description + + + + + &jersey.media.multipart.MultiPartProperties.BUFFER_THRESHOLD; + jersey.config.multipart.bufferThreshold + + + Name of the resource property for the threshold size (in bytes) above which a + body part entity will be buffered to disk instead of being held in memory. + + + The default value is &jersey.message.MessageProperties.IO_DEFAULT_BUFFER_SIZE; + + + + + &jersey.media.multipart.MultiPartProperties.MAX_PARTS; + jersey.config.multipart.maxParts + + + Limit the maximum number of parts the multipart entity can have. If the limit is over, + the error response status 413 - REQUEST_ENTITY_TOO_LARGE + is returned. + + + By default, the number is unlimited. + + + + + &jersey.media.multipart.MultiPartProperties.MULTI_PART_CONFIG_RESOURCE; + jersey-multipart-config.properties + + + Name of a properties resource that (if found in the classpath + for this application) will be used to configure the settings returned + by our getter methods. + + + + + &jersey.media.multipart.MultiPartProperties.TEMP_DIRECTORY; + jersey.config.multipart.tempDir + + + Name of the resource property for the directory to store temporary files containing body parts + of multipart message that extends allowed memory threshold. + + + The default value is not set (will be taken from java.io.tmpdir system property). + + + + + +
+
\ No newline at end of file diff --git a/docs/src/main/docbook/jersey.ent b/docs/src/main/docbook/jersey.ent index 6674d4e934..ccbe0216ea 100644 --- a/docs/src/main/docbook/jersey.ent +++ b/docs/src/main/docbook/jersey.ent @@ -536,7 +536,12 @@ @FormDataParam" > MultiPart" > MultiPartFeature" > -StreamDataBodyPart" > +MultiPartProperties" > +MultiPartProperties.BUFFER_THRESHOLD"> +MultiPartProperties.MAX_PARTS"> +MultiPartProperties.MULTI_PART_CONFIG_RESOURCE"> +MultiPartProperties.TEMP_DIRECTORY"> +StreamDataBodyPart"> MessageBodyWorkers"> MessageProperties"> MessageProperties.DEFLATE_WITHOUT_ZLIB"> diff --git a/docs/src/main/docbook/media.xml b/docs/src/main/docbook/media.xml index 1fafb797d2..965aad10e3 100644 --- a/docs/src/main/docbook/media.xml +++ b/docs/src/main/docbook/media.xml @@ -1,7 +1,7 @@