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 <[email protected]> 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());
