You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/11/29 11:00:49 UTC

(camel) branch CAMEL-20152/jetty-add-file-size-threshold-4.0 created (now dc133eeeb98)

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a change to branch CAMEL-20152/jetty-add-file-size-threshold-4.0
in repository https://gitbox.apache.org/repos/asf/camel.git


      at dc133eeeb98 CAMEL-20152: camel-jetty - Fix a file size threshold

This branch includes the following new commits:

     new dc133eeeb98 CAMEL-20152: camel-jetty - Fix a file size threshold

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel) 01/01: CAMEL-20152: camel-jetty - Fix a file size threshold

Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch CAMEL-20152/jetty-add-file-size-threshold-4.0
in repository https://gitbox.apache.org/repos/asf/camel.git

commit dc133eeeb987252be6f15e6cddf43ef43e94be3e
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Wed Nov 29 11:27:42 2023 +0100

    CAMEL-20152: camel-jetty - Fix a file size threshold
---
 .../java/org/apache/camel/component/jetty/JettyHttpComponent.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
index ba3b3f177eb..cf3080b96c9 100644
--- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
@@ -106,6 +106,10 @@ public abstract class JettyHttpComponent extends HttpCommonComponent
     private static final String JETTY_SSL_KEYSTORE = "org.eclipse.jetty.ssl.keystore";
     private static final String JETTY_SSL_KEYPASSWORD = "org.eclipse.jetty.ssl.keypassword";
     private static final String JETTY_SSL_PASSWORD = "org.eclipse.jetty.ssl.password";
+    /**
+     * The default value in bytes of the threshold beyond which the multipart files are written to disk to prevent OOME.
+     */
+    private static final int DEFAULT_FILE_SIZE_THRESHOLD = 10 * 1024 * 1024;
 
     protected String sslKeyPassword;
     protected String sslPassword;
@@ -1150,7 +1154,8 @@ public abstract class JettyHttpComponent extends HttpCommonComponent
 
         //must register the MultipartConfig to make jetty server multipart aware
         holder.getRegistration()
-                .setMultipartConfig(new MultipartConfigElement(file.getParentFile().getAbsolutePath(), -1, -1, 0));
+                .setMultipartConfig(new MultipartConfigElement(
+                        file.getParentFile().getAbsolutePath(), -1, -1, DEFAULT_FILE_SIZE_THRESHOLD));
 
         // use rest enabled resolver in case we use rest
         camelServlet.setServletResolveConsumerStrategy(new HttpRestServletResolveConsumerStrategy());