This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.x by this push:
new 843a6e8d69a CAMEL-20152: camel-jetty - Allow to configure the
multipart (#12249)
843a6e8d69a is described below
commit 843a6e8d69afb2994a4d752e2bb6266e4badd601
Author: Nicolas Filotto <[email protected]>
AuthorDate: Wed Nov 29 11:48:07 2023 +0100
CAMEL-20152: camel-jetty - Allow to configure the multipart (#12249)
## Motivation
In the case of multipart, the content is kept in memory which can lead to
an OOME, it is due to the fact that the `fileSizeThreshold` is set to `0` by
default which should mean that the content is stored on disk according to the
Jakarta Javadoc but it is not what the Jetty code expects.
## Modifications:
* Propose new properties to be able to configure the multipart
* Add a unit test to ensure that the file content is stored on disk
---
.../org/apache/camel/catalog/components/jetty.json | 8 ++
.../camel/component/jetty/JettyHttpComponent.java | 68 ++++++++++--
.../camel/component/jetty/JettyHttpEndpoint.java | 43 ++++++++
.../jetty9/JettyHttp9EndpointUriFactory.java | 6 +-
.../jetty9/JettyHttpComponent9Configurer.java | 24 +++++
.../jetty9/JettyHttpEndpoint9Configurer.java | 24 +++++
.../org/apache/camel/component/jetty9/jetty.json | 8 ++
.../component/jetty/MultiPartFormBigFileTest.java | 99 ++++++++++++++++++
.../dsl/JettyComponentBuilderFactory.java | 69 +++++++++++++
.../dsl/JettyHttpEndpointBuilderFactory.java | 114 +++++++++++++++++++++
10 files changed, 456 insertions(+), 7 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jetty.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jetty.json
index 66bf53a6e98..9bc892e8191 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jetty.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jetty.json
@@ -36,6 +36,10 @@
"sendServerVersion": { "kind": "property", "displayName": "Send Server
Version", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "defaultValue": true, "description": "If
the option is true, jetty will send the server header with the jetty version
information to the client which sends the request. NOTE please make sure there
is no any other camel-jett [...]
"useContinuation": { "kind": "property", "displayName": "Use
Continuation", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue":
true, "description": "Whether or not to use Jetty continuations for the Jetty
Server." },
"useXForwardedForHeader": { "kind": "property", "displayName": "Use
XForwarded For Header", "group": "consumer", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue":
false, "description": "To use the X-Forwarded-For header in
HttpServletRequest.getRemoteAddr." },
+ "fileSizeThreshold": { "kind": "property", "displayName": "File Size
Threshold", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue": 0,
"description": "The size threshold after which files will be written to disk
for multipart\/form-data requests. By default the files are not written to
disk" },
+ "filesLocation": { "kind": "property", "displayName": "Files Location",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "description": "The
directory location where files will be store for multipart\/form-data requests.
By default the files are written in the system temporary folder" },
+ "maxFileSize": { "kind": "property", "displayName": "Max File Size",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue": -1,
"description": "The maximum size allowed for uploaded files. -1 means no limit"
},
+ "maxRequestSize": { "kind": "property", "displayName": "Max Request Size",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue": -1,
"description": "The maximum size allowed for multipart\/form-data requests. -1
means no limit" },
"threadPool": { "kind": "property", "displayName": "Thread Pool", "group":
"consumer (advanced)", "label": "consumer,advanced", "required": false, "type":
"object", "javaType": "org.eclipse.jetty.util.thread.ThreadPool", "deprecated":
false, "deprecationNote": "", "autowired": false, "secret": false,
"description": "To use a custom thread pool for the server. This option should
only be used in special circumstances." },
"allowJavaSerializedObject": { "kind": "property", "displayName": "Allow
Java Serialized Object", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to allow java serialization when a request uses
context-type=application\/x-java-serialized-object. This is by default turned
off. If you enable this then be aware that Java will des [...]
"autowiredEnabled": { "kind": "property", "displayName": "Autowired
Enabled", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether autowiring is
enabled. This is used for automatic autowiring options (the option must be
marked as autowired) by looking up in the registry to find if there is a single
instance of matching type, which t [...]
@@ -85,12 +89,16 @@
"eagerCheckContentAvailable": { "kind": "parameter", "displayName": "Eager
Check Content Available", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to eager check whether the HTTP
requests has content if the content-length header is 0 or not present. This can
be turned on in case HTTP clients do not send s [...]
"exceptionHandler": { "kind": "parameter", "displayName": "Exception
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By default the
con [...]
"exchangePattern": { "kind": "parameter", "displayName": "Exchange
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut",
"InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false,
"description": "Sets the exchange pattern when the consumer creates an
exchange." },
+ "fileSizeThreshold": { "kind": "parameter", "displayName": "File Size
Threshold", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "java.lang.Integer",
"deprecated": false, "autowired": false, "secret": false, "description": "The
size threshold after which files will be written to disk for
multipart\/form-data requests. By default the files are not written to disk" },
+ "filesLocation": { "kind": "parameter", "displayName": "Files Location",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "The directory location
where files will be store for multipart\/form-data requests. By default the
files are written in the system temporary folder" },
"filterInitParameters": { "kind": "parameter", "displayName": "Filter Init
Parameters", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.String>", "prefix": "filter.",
"multiValue": true, "deprecated": false, "autowired": false, "secret": false,
"description": "Configuration of the filter init parameters. These parameters
will be applied to the filter list before starting the jett [...]
"filters": { "kind": "parameter", "displayName": "Filters", "group":
"consumer (advanced)", "label": "consumer,advanced", "required": false, "type":
"array", "javaType": "java.util.List<javax.servlet.Filter>", "deprecated":
false, "autowired": false, "secret": false, "description": "Allows using a
custom filters which is putted into a list and can be find in the Registry.
Multiple values can be separated by comma." },
"handlers": { "kind": "parameter", "displayName": "Handlers", "group":
"consumer (advanced)", "label": "consumer,advanced", "required": false, "type":
"array", "javaType": "java.util.List<org.eclipse.jetty.server.Handler>",
"deprecated": false, "autowired": false, "secret": false, "description":
"Specifies a comma-delimited set of Handler instances to lookup in your
Registry. These handlers are added to the Jetty servlet context (for example,
to add security). Important: You can not [...]
"mapHttpMessageBody": { "kind": "parameter", "displayName": "Map Http
Message Body", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "If this option is true then IN exchange Body of the exchange
will be mapped to HTTP body. Setting this to false will avoid the HTTP
mapping." },
"mapHttpMessageFormUrlEncodedBody": { "kind": "parameter", "displayName":
"Map Http Message Form Url Encoded Body", "group": "consumer (advanced)",
"label": "consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "If this option is true then IN exchange
Form Encoded body of the exchange will be mapped to HTTP. Setting this to false
will avoid the HTTP Form Encoded [...]
"mapHttpMessageHeaders": { "kind": "parameter", "displayName": "Map Http
Message Headers", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "If this option is true then IN exchange Headers of the exchange
will be mapped to HTTP headers. Setting this to false will avoid the HTTP
Headers mapping." },
+ "maxFileSize": { "kind": "parameter", "displayName": "Max File Size",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false,
"autowired": false, "secret": false, "description": "The maximum size allowed
for uploaded files. -1 means no limit" },
+ "maxRequestSize": { "kind": "parameter", "displayName": "Max Request
Size", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "java.lang.Long",
"deprecated": false, "autowired": false, "secret": false, "description": "The
maximum size allowed for multipart\/form-data requests. -1 means no limit" },
"multipartFilter": { "kind": "parameter", "displayName": "Multipart
Filter", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType": "javax.servlet.Filter",
"deprecated": false, "autowired": false, "secret": false, "description":
"Allows using a custom multipart filter. Note: setting multipartFilterRef
forces the value of enableMultipartFilter to true." },
"optionsEnabled": { "kind": "parameter", "displayName": "Options Enabled",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Specifies whether to enable HTTP OPTIONS for this Servlet consumer. By default
OPTIONS is turned off." },
"traceEnabled": { "kind": "parameter", "displayName": "Trace Enabled",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Specifies whether to enable HTTP TRACE for this Servlet consumer. By default
TRACE is turned off." },
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 c69a50c96ae..3c62fb3fcf8 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
@@ -134,6 +134,10 @@ public abstract class JettyHttpComponent extends
HttpCommonComponent
private Integer proxyPort;
private boolean sendServerVersion = true;
private QueuedThreadPool defaultQueuedThreadPool;
+ private String filesLocation;
+ private Long maxFileSize = -1L;
+ private Long maxRequestSize = -1L;
+ private Integer fileSizeThreshold = 0;
public JettyHttpComponent() {
}
@@ -186,6 +190,11 @@ public abstract class JettyHttpComponent extends
HttpCommonComponent
Integer proxyPort = getAndRemoveParameter(parameters, "proxyPort",
Integer.class, getProxyPort());
Boolean async = getAndRemoveParameter(parameters, "async",
Boolean.class);
boolean muteException = getAndRemoveParameter(parameters,
"muteException", boolean.class, isMuteException());
+ String filesLocation = getAndRemoveParameter(parameters,
"filesLocation", String.class, getFilesLocation());
+ Integer fileSizeThreshold
+ = getAndRemoveParameter(parameters, "fileSizeThreshold",
Integer.class, getFileSizeThreshold());
+ Long maxFileSize = getAndRemoveParameter(parameters, "maxFileSize",
Long.class, getMaxFileSize());
+ Long maxRequestSize = getAndRemoveParameter(parameters,
"maxRequestSize", Long.class, getMaxRequestSize());
// extract filterInit. parameters
Map filterInitParameters =
PropertiesHelper.extractProperties(parameters, "filterInit.");
@@ -263,7 +272,10 @@ public abstract class JettyHttpComponent extends
HttpCommonComponent
endpoint.setSslContextParameters(ssl);
}
endpoint.setSendServerVersion(isSendServerVersion());
-
+ endpoint.setFilesLocation(filesLocation);
+ endpoint.setFileSizeThreshold(fileSizeThreshold);
+ endpoint.setMaxFileSize(maxFileSize);
+ endpoint.setMaxRequestSize(maxRequestSize);
setProperties(endpoint, parameters);
// re-create http uri after all parameters has been set on the
endpoint, as the remainders are for http uri
@@ -1038,6 +1050,46 @@ public abstract class JettyHttpComponent extends
HttpCommonComponent
this.sendServerVersion = sendServerVersion;
}
+ public long getMaxFileSize() {
+ return maxFileSize;
+ }
+
+ @Metadata(description = "The maximum size allowed for uploaded files. -1
means no limit",
+ defaultValue = "-1", label = "consumer,advanced")
+ public void setMaxFileSize(long maxFileSize) {
+ this.maxFileSize = maxFileSize;
+ }
+
+ public long getMaxRequestSize() {
+ return maxRequestSize;
+ }
+
+ @Metadata(description = "The maximum size allowed for multipart/form-data
requests. -1 means no limit",
+ defaultValue = "-1", label = "consumer,advanced")
+ public void setMaxRequestSize(long maxRequestSize) {
+ this.maxRequestSize = maxRequestSize;
+ }
+
+ public int getFileSizeThreshold() {
+ return fileSizeThreshold;
+ }
+
+ @Metadata(description = "The size threshold after which files will be
written to disk for multipart/form-data requests. By default the files are not
written to disk",
+ defaultValue = "0", label = "consumer,advanced")
+ public void setFileSizeThreshold(int fileSizeThreshold) {
+ this.fileSizeThreshold = fileSizeThreshold;
+ }
+
+ public String getFilesLocation() {
+ return filesLocation;
+ }
+
+ @Metadata(description = "The directory location where files will be store
for multipart/form-data requests. By default the files are written in the
system temporary folder",
+ label = "consumer,advanced")
+ public void setFilesLocation(String filesLocation) {
+ this.filesLocation = filesLocation;
+ }
+
// Implementation methods
//
-------------------------------------------------------------------------
@@ -1164,15 +1216,19 @@ public abstract class JettyHttpComponent extends
HttpCommonComponent
holder.setInitParameter(CamelServlet.ASYNC_PARAM,
Boolean.toString(endpoint.isAsync()));
context.addServlet(holder, "/*");
- File file = File.createTempFile("camel", "");
- boolean result = file.delete();
- if (!result) {
- LOG.error("failed to delete {}", file);
+ String location = endpoint.getFilesLocation();
+ if (location == null) {
+ File file = File.createTempFile("camel", "");
+ if (!FileUtil.deleteFile(file)) {
+ LOG.error("failed to delete {}", file);
+ }
+ location = file.getParentFile().getAbsolutePath();
}
//must register the MultipartConfig to make jetty server multipart
aware
holder.getRegistration()
- .setMultipartConfig(new
MultipartConfigElement(file.getParentFile().getAbsolutePath(), -1, -1, 0));
+ .setMultipartConfig(new MultipartConfigElement(
+ location, endpoint.getMaxFileSize(),
endpoint.getMaxRequestSize(), endpoint.getFileSizeThreshold()));
// use rest enabled resolver in case we use rest
camelServlet.setServletResolveConsumerStrategy(new
HttpRestServletResolveConsumerStrategy());
diff --git
a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
index 1eda82dbe82..f98a0534408 100644
---
a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
+++
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
@@ -80,6 +80,17 @@ public abstract class JettyHttpEndpoint extends
HttpCommonEndpoint {
@UriParam(label = "security",
description = "To configure security using SSLContextParameters")
private SSLContextParameters sslContextParameters;
+ @UriParam(label = "consumer,advanced",
+ description = "The directory location where files will be store
for multipart/form-data requests. By default the files are written in the
system temporary folder")
+ private String filesLocation;
+ @UriParam(label = "consumer,advanced", description = "The maximum size
allowed for uploaded files. -1 means no limit")
+ private Long maxFileSize;
+ @UriParam(label = "consumer,advanced",
+ description = "The size threshold after which files will be
written to disk for multipart/form-data requests. By default the files are not
written to disk")
+ private Integer fileSizeThreshold;
+ @UriParam(label = "consumer,advanced",
+ description = "The maximum size allowed for multipart/form-data
requests. -1 means no limit")
+ private Long maxRequestSize;
public JettyHttpEndpoint(JettyHttpComponent component, String uri, URI
httpURL) {
super(uri, component, httpURL);
@@ -261,4 +272,36 @@ public abstract class JettyHttpEndpoint extends
HttpCommonEndpoint {
public abstract JettyContentExchange createContentExchange();
+ public String getFilesLocation() {
+ return filesLocation;
+ }
+
+ public void setFilesLocation(String filesLocation) {
+ this.filesLocation = filesLocation;
+ }
+
+ public Long getMaxFileSize() {
+ return maxFileSize;
+ }
+
+ public void setMaxFileSize(Long maxFileSize) {
+ this.maxFileSize = maxFileSize;
+ }
+
+ public Integer getFileSizeThreshold() {
+ return fileSizeThreshold;
+ }
+
+ public void setFileSizeThreshold(Integer fileSizeThreshold) {
+ this.fileSizeThreshold = fileSizeThreshold;
+ }
+
+ public Long getMaxRequestSize() {
+ return maxRequestSize;
+ }
+
+ public void setMaxRequestSize(Long maxRequestSize) {
+ this.maxRequestSize = maxRequestSize;
+ }
+
}
diff --git
a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttp9EndpointUriFactory.java
b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttp9EndpointUriFactory.java
index f5efcfcb92b..0e7e116156d 100644
---
a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttp9EndpointUriFactory.java
+++
b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttp9EndpointUriFactory.java
@@ -21,7 +21,7 @@ public class JettyHttp9EndpointUriFactory extends
org.apache.camel.support.compo
private static final Set<String> SECRET_PROPERTY_NAMES;
private static final Set<String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(33);
+ Set<String> props = new HashSet<>(37);
props.add("async");
props.add("bridgeErrorHandler");
props.add("chunked");
@@ -33,6 +33,8 @@ public class JettyHttp9EndpointUriFactory extends
org.apache.camel.support.compo
props.add("enableMultipartFilter");
props.add("exceptionHandler");
props.add("exchangePattern");
+ props.add("fileSizeThreshold");
+ props.add("filesLocation");
props.add("filterInitParameters");
props.add("filters");
props.add("handlers");
@@ -44,6 +46,8 @@ public class JettyHttp9EndpointUriFactory extends
org.apache.camel.support.compo
props.add("mapHttpMessageFormUrlEncodedBody");
props.add("mapHttpMessageHeaders");
props.add("matchOnUriPrefix");
+ props.add("maxFileSize");
+ props.add("maxRequestSize");
props.add("multipartFilter");
props.add("muteException");
props.add("optionsEnabled");
diff --git
a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttpComponent9Configurer.java
b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttpComponent9Configurer.java
index 8211d97dbd2..fa52e2c6e8f 100644
---
a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttpComponent9Configurer.java
+++
b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttpComponent9Configurer.java
@@ -33,6 +33,10 @@ public class JettyHttpComponent9Configurer extends
PropertyConfigurerSupport imp
case "enableJmx": target.setEnableJmx(property(camelContext,
boolean.class, value)); return true;
case "errorhandler":
case "errorHandler": target.setErrorHandler(property(camelContext,
org.eclipse.jetty.server.handler.ErrorHandler.class, value)); return true;
+ case "filesizethreshold":
+ case "fileSizeThreshold":
target.setFileSizeThreshold(property(camelContext, int.class, value)); return
true;
+ case "fileslocation":
+ case "filesLocation": target.setFilesLocation(property(camelContext,
java.lang.String.class, value)); return true;
case "headerfilterstrategy":
case "headerFilterStrategy":
target.setHeaderFilterStrategy(property(camelContext,
org.apache.camel.spi.HeaderFilterStrategy.class, value)); return true;
case "httpbinding":
@@ -42,6 +46,10 @@ public class JettyHttpComponent9Configurer extends
PropertyConfigurerSupport imp
case "jettyhttpbinding":
case "jettyHttpBinding":
target.setJettyHttpBinding(property(camelContext,
org.apache.camel.component.jetty.JettyHttpBinding.class, value)); return true;
case "keystore": target.setKeystore(property(camelContext,
java.lang.String.class, value)); return true;
+ case "maxfilesize":
+ case "maxFileSize": target.setMaxFileSize(property(camelContext,
long.class, value)); return true;
+ case "maxrequestsize":
+ case "maxRequestSize": target.setMaxRequestSize(property(camelContext,
long.class, value)); return true;
case "maxthreads":
case "maxThreads": target.setMaxThreads(property(camelContext,
java.lang.Integer.class, value)); return true;
case "mbcontainer":
@@ -105,6 +113,10 @@ public class JettyHttpComponent9Configurer extends
PropertyConfigurerSupport imp
case "enableJmx": return boolean.class;
case "errorhandler":
case "errorHandler": return
org.eclipse.jetty.server.handler.ErrorHandler.class;
+ case "filesizethreshold":
+ case "fileSizeThreshold": return int.class;
+ case "fileslocation":
+ case "filesLocation": return java.lang.String.class;
case "headerfilterstrategy":
case "headerFilterStrategy": return
org.apache.camel.spi.HeaderFilterStrategy.class;
case "httpbinding":
@@ -114,6 +126,10 @@ public class JettyHttpComponent9Configurer extends
PropertyConfigurerSupport imp
case "jettyhttpbinding":
case "jettyHttpBinding": return
org.apache.camel.component.jetty.JettyHttpBinding.class;
case "keystore": return java.lang.String.class;
+ case "maxfilesize":
+ case "maxFileSize": return long.class;
+ case "maxrequestsize":
+ case "maxRequestSize": return long.class;
case "maxthreads":
case "maxThreads": return java.lang.Integer.class;
case "mbcontainer":
@@ -178,6 +194,10 @@ public class JettyHttpComponent9Configurer extends
PropertyConfigurerSupport imp
case "enableJmx": return target.isEnableJmx();
case "errorhandler":
case "errorHandler": return target.getErrorHandler();
+ case "filesizethreshold":
+ case "fileSizeThreshold": return target.getFileSizeThreshold();
+ case "fileslocation":
+ case "filesLocation": return target.getFilesLocation();
case "headerfilterstrategy":
case "headerFilterStrategy": return target.getHeaderFilterStrategy();
case "httpbinding":
@@ -187,6 +207,10 @@ public class JettyHttpComponent9Configurer extends
PropertyConfigurerSupport imp
case "jettyhttpbinding":
case "jettyHttpBinding": return target.getJettyHttpBinding();
case "keystore": return target.getKeystore();
+ case "maxfilesize":
+ case "maxFileSize": return target.getMaxFileSize();
+ case "maxrequestsize":
+ case "maxRequestSize": return target.getMaxRequestSize();
case "maxthreads":
case "maxThreads": return target.getMaxThreads();
case "mbcontainer":
diff --git
a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9Configurer.java
b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9Configurer.java
index 5e258336b5f..87a964812a9 100644
---
a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9Configurer.java
+++
b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9Configurer.java
@@ -41,6 +41,10 @@ public class JettyHttpEndpoint9Configurer extends
PropertyConfigurerSupport impl
case "exceptionHandler":
target.setExceptionHandler(property(camelContext,
org.apache.camel.spi.ExceptionHandler.class, value)); return true;
case "exchangepattern":
case "exchangePattern":
target.setExchangePattern(property(camelContext,
org.apache.camel.ExchangePattern.class, value)); return true;
+ case "filesizethreshold":
+ case "fileSizeThreshold":
target.setFileSizeThreshold(property(camelContext, java.lang.Integer.class,
value)); return true;
+ case "fileslocation":
+ case "filesLocation": target.setFilesLocation(property(camelContext,
java.lang.String.class, value)); return true;
case "filterinitparameters":
case "filterInitParameters":
target.setFilterInitParameters(property(camelContext, java.util.Map.class,
value)); return true;
case "filters": target.setFilters(property(camelContext,
java.util.List.class, value)); return true;
@@ -59,6 +63,10 @@ public class JettyHttpEndpoint9Configurer extends
PropertyConfigurerSupport impl
case "mapHttpMessageHeaders":
target.setMapHttpMessageHeaders(property(camelContext, boolean.class, value));
return true;
case "matchonuriprefix":
case "matchOnUriPrefix":
target.setMatchOnUriPrefix(property(camelContext, boolean.class, value));
return true;
+ case "maxfilesize":
+ case "maxFileSize": target.setMaxFileSize(property(camelContext,
java.lang.Long.class, value)); return true;
+ case "maxrequestsize":
+ case "maxRequestSize": target.setMaxRequestSize(property(camelContext,
java.lang.Long.class, value)); return true;
case "multipartfilter":
case "multipartFilter":
target.setMultipartFilter(property(camelContext, javax.servlet.Filter.class,
value)); return true;
case "muteexception":
@@ -108,6 +116,10 @@ public class JettyHttpEndpoint9Configurer extends
PropertyConfigurerSupport impl
case "exceptionHandler": return
org.apache.camel.spi.ExceptionHandler.class;
case "exchangepattern":
case "exchangePattern": return org.apache.camel.ExchangePattern.class;
+ case "filesizethreshold":
+ case "fileSizeThreshold": return java.lang.Integer.class;
+ case "fileslocation":
+ case "filesLocation": return java.lang.String.class;
case "filterinitparameters":
case "filterInitParameters": return java.util.Map.class;
case "filters": return java.util.List.class;
@@ -126,6 +138,10 @@ public class JettyHttpEndpoint9Configurer extends
PropertyConfigurerSupport impl
case "mapHttpMessageHeaders": return boolean.class;
case "matchonuriprefix":
case "matchOnUriPrefix": return boolean.class;
+ case "maxfilesize":
+ case "maxFileSize": return java.lang.Long.class;
+ case "maxrequestsize":
+ case "maxRequestSize": return java.lang.Long.class;
case "multipartfilter":
case "multipartFilter": return javax.servlet.Filter.class;
case "muteexception":
@@ -176,6 +192,10 @@ public class JettyHttpEndpoint9Configurer extends
PropertyConfigurerSupport impl
case "exceptionHandler": return target.getExceptionHandler();
case "exchangepattern":
case "exchangePattern": return target.getExchangePattern();
+ case "filesizethreshold":
+ case "fileSizeThreshold": return target.getFileSizeThreshold();
+ case "fileslocation":
+ case "filesLocation": return target.getFilesLocation();
case "filterinitparameters":
case "filterInitParameters": return target.getFilterInitParameters();
case "filters": return target.getFilters();
@@ -194,6 +214,10 @@ public class JettyHttpEndpoint9Configurer extends
PropertyConfigurerSupport impl
case "mapHttpMessageHeaders": return target.isMapHttpMessageHeaders();
case "matchonuriprefix":
case "matchOnUriPrefix": return target.isMatchOnUriPrefix();
+ case "maxfilesize":
+ case "maxFileSize": return target.getMaxFileSize();
+ case "maxrequestsize":
+ case "maxRequestSize": return target.getMaxRequestSize();
case "multipartfilter":
case "multipartFilter": return target.getMultipartFilter();
case "muteexception":
diff --git
a/components/camel-jetty/src/generated/resources/org/apache/camel/component/jetty9/jetty.json
b/components/camel-jetty/src/generated/resources/org/apache/camel/component/jetty9/jetty.json
index 66bf53a6e98..9bc892e8191 100644
---
a/components/camel-jetty/src/generated/resources/org/apache/camel/component/jetty9/jetty.json
+++
b/components/camel-jetty/src/generated/resources/org/apache/camel/component/jetty9/jetty.json
@@ -36,6 +36,10 @@
"sendServerVersion": { "kind": "property", "displayName": "Send Server
Version", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "defaultValue": true, "description": "If
the option is true, jetty will send the server header with the jetty version
information to the client which sends the request. NOTE please make sure there
is no any other camel-jett [...]
"useContinuation": { "kind": "property", "displayName": "Use
Continuation", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue":
true, "description": "Whether or not to use Jetty continuations for the Jetty
Server." },
"useXForwardedForHeader": { "kind": "property", "displayName": "Use
XForwarded For Header", "group": "consumer", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue":
false, "description": "To use the X-Forwarded-For header in
HttpServletRequest.getRemoteAddr." },
+ "fileSizeThreshold": { "kind": "property", "displayName": "File Size
Threshold", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue": 0,
"description": "The size threshold after which files will be written to disk
for multipart\/form-data requests. By default the files are not written to
disk" },
+ "filesLocation": { "kind": "property", "displayName": "Files Location",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "description": "The
directory location where files will be store for multipart\/form-data requests.
By default the files are written in the system temporary folder" },
+ "maxFileSize": { "kind": "property", "displayName": "Max File Size",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue": -1,
"description": "The maximum size allowed for uploaded files. -1 means no limit"
},
+ "maxRequestSize": { "kind": "property", "displayName": "Max Request Size",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue": -1,
"description": "The maximum size allowed for multipart\/form-data requests. -1
means no limit" },
"threadPool": { "kind": "property", "displayName": "Thread Pool", "group":
"consumer (advanced)", "label": "consumer,advanced", "required": false, "type":
"object", "javaType": "org.eclipse.jetty.util.thread.ThreadPool", "deprecated":
false, "deprecationNote": "", "autowired": false, "secret": false,
"description": "To use a custom thread pool for the server. This option should
only be used in special circumstances." },
"allowJavaSerializedObject": { "kind": "property", "displayName": "Allow
Java Serialized Object", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to allow java serialization when a request uses
context-type=application\/x-java-serialized-object. This is by default turned
off. If you enable this then be aware that Java will des [...]
"autowiredEnabled": { "kind": "property", "displayName": "Autowired
Enabled", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether autowiring is
enabled. This is used for automatic autowiring options (the option must be
marked as autowired) by looking up in the registry to find if there is a single
instance of matching type, which t [...]
@@ -85,12 +89,16 @@
"eagerCheckContentAvailable": { "kind": "parameter", "displayName": "Eager
Check Content Available", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to eager check whether the HTTP
requests has content if the content-length header is 0 or not present. This can
be turned on in case HTTP clients do not send s [...]
"exceptionHandler": { "kind": "parameter", "displayName": "Exception
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By default the
con [...]
"exchangePattern": { "kind": "parameter", "displayName": "Exchange
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut",
"InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false,
"description": "Sets the exchange pattern when the consumer creates an
exchange." },
+ "fileSizeThreshold": { "kind": "parameter", "displayName": "File Size
Threshold", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "java.lang.Integer",
"deprecated": false, "autowired": false, "secret": false, "description": "The
size threshold after which files will be written to disk for
multipart\/form-data requests. By default the files are not written to disk" },
+ "filesLocation": { "kind": "parameter", "displayName": "Files Location",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "The directory location
where files will be store for multipart\/form-data requests. By default the
files are written in the system temporary folder" },
"filterInitParameters": { "kind": "parameter", "displayName": "Filter Init
Parameters", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.String>", "prefix": "filter.",
"multiValue": true, "deprecated": false, "autowired": false, "secret": false,
"description": "Configuration of the filter init parameters. These parameters
will be applied to the filter list before starting the jett [...]
"filters": { "kind": "parameter", "displayName": "Filters", "group":
"consumer (advanced)", "label": "consumer,advanced", "required": false, "type":
"array", "javaType": "java.util.List<javax.servlet.Filter>", "deprecated":
false, "autowired": false, "secret": false, "description": "Allows using a
custom filters which is putted into a list and can be find in the Registry.
Multiple values can be separated by comma." },
"handlers": { "kind": "parameter", "displayName": "Handlers", "group":
"consumer (advanced)", "label": "consumer,advanced", "required": false, "type":
"array", "javaType": "java.util.List<org.eclipse.jetty.server.Handler>",
"deprecated": false, "autowired": false, "secret": false, "description":
"Specifies a comma-delimited set of Handler instances to lookup in your
Registry. These handlers are added to the Jetty servlet context (for example,
to add security). Important: You can not [...]
"mapHttpMessageBody": { "kind": "parameter", "displayName": "Map Http
Message Body", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "If this option is true then IN exchange Body of the exchange
will be mapped to HTTP body. Setting this to false will avoid the HTTP
mapping." },
"mapHttpMessageFormUrlEncodedBody": { "kind": "parameter", "displayName":
"Map Http Message Form Url Encoded Body", "group": "consumer (advanced)",
"label": "consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "If this option is true then IN exchange
Form Encoded body of the exchange will be mapped to HTTP. Setting this to false
will avoid the HTTP Form Encoded [...]
"mapHttpMessageHeaders": { "kind": "parameter", "displayName": "Map Http
Message Headers", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "If this option is true then IN exchange Headers of the exchange
will be mapped to HTTP headers. Setting this to false will avoid the HTTP
Headers mapping." },
+ "maxFileSize": { "kind": "parameter", "displayName": "Max File Size",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false,
"autowired": false, "secret": false, "description": "The maximum size allowed
for uploaded files. -1 means no limit" },
+ "maxRequestSize": { "kind": "parameter", "displayName": "Max Request
Size", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "java.lang.Long",
"deprecated": false, "autowired": false, "secret": false, "description": "The
maximum size allowed for multipart\/form-data requests. -1 means no limit" },
"multipartFilter": { "kind": "parameter", "displayName": "Multipart
Filter", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType": "javax.servlet.Filter",
"deprecated": false, "autowired": false, "secret": false, "description":
"Allows using a custom multipart filter. Note: setting multipartFilterRef
forces the value of enableMultipartFilter to true." },
"optionsEnabled": { "kind": "parameter", "displayName": "Options Enabled",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Specifies whether to enable HTTP OPTIONS for this Servlet consumer. By default
OPTIONS is turned off." },
"traceEnabled": { "kind": "parameter", "displayName": "Trace Enabled",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Specifies whether to enable HTTP TRACE for this Servlet consumer. By default
TRACE is turned off." },
diff --git
a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormBigFileTest.java
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormBigFileTest.java
new file mode 100644
index 00000000000..46a492e34a2
--- /dev/null
+++
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormBigFileTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.activation.DataHandler;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.attachment.AttachmentMessage;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.util.IOHelper;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class MultiPartFormBigFileTest extends BaseJettyTest {
+
+ @TempDir
+ File tempDir;
+
+ private HttpEntity createMultipartRequestEntityWithBigFile() {
+ return MultipartEntityBuilder.create().addTextBody("comment", "A
binary file of some kind").build();
+
+ }
+
+ @Test
+ void testSendMultiPartFormWithBigFile() throws Exception {
+ org.apache.http.client.HttpClient client =
HttpClientBuilder.create().build();
+ HttpPost post = new HttpPost("http://localhost:" + getPort() +
"/test");
+ post.setEntity(createMultipartRequestEntityWithBigFile());
+ HttpResponse response = client.execute(post);
+ int status = response.getStatusLine().getStatusCode();
+
+ assertEquals(200, status, "Get a wrong response status");
+ String result =
IOHelper.loadText(response.getEntity().getContent()).trim();
+
+ assertEquals(Integer.toString("A binary file of some kind".length()),
result, "Get a wrong result");
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+
+
fromF("jetty://http://localhost:{{port}}/test?filesLocation=%s&fileSizeThreshold=1",
+ tempDir.getAbsolutePath())
+ .process(new Processor() {
+
+ public void process(Exchange exchange)
throws Exception {
+ AttachmentMessage in =
exchange.getIn(AttachmentMessage.class);
+ assertEquals(1,
in.getAttachments().size(), "Get a wrong attachment size");
+ // The file name is attachment id
+ DataHandler data =
in.getAttachment("comment");
+ assertNotNull(data, "Should get the
DataHandle comment");
+ assertTrue(tempDir.exists() &&
tempDir.list() != null && tempDir.list().length > 0);
+ int received = 0;
+ try (InputStream files =
data.getInputStream()) {
+ byte[] buffer = new byte[256];
+ int b;
+ while ((b = files.read(buffer)) !=
-1) {
+ received += b;
+ }
+
exchange.getMessage().setBody(Integer.toString(received));
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ });
+ }
+ };
+ }
+}
diff --git
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/JettyComponentBuilderFactory.java
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/JettyComponentBuilderFactory.java
index b5b006567cc..45724194a38 100644
---
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/JettyComponentBuilderFactory.java
+++
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/JettyComponentBuilderFactory.java
@@ -270,6 +270,71 @@ public interface JettyComponentBuilderFactory {
doSetProperty("useXForwardedForHeader", useXForwardedForHeader);
return this;
}
+ /**
+ * The size threshold after which files will be written to disk for
+ * multipart/form-data requests. By default the files are not written
to
+ * disk.
+ *
+ * The option is a: <code>int</code> type.
+ *
+ * Default: 0
+ * Group: consumer (advanced)
+ *
+ * @param fileSizeThreshold the value to set
+ * @return the dsl builder
+ */
+ default JettyComponentBuilder fileSizeThreshold(int fileSizeThreshold)
{
+ doSetProperty("fileSizeThreshold", fileSizeThreshold);
+ return this;
+ }
+ /**
+ * The directory location where files will be store for
+ * multipart/form-data requests. By default the files are written in
the
+ * system temporary folder.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: consumer (advanced)
+ *
+ * @param filesLocation the value to set
+ * @return the dsl builder
+ */
+ default JettyComponentBuilder filesLocation(
+ java.lang.String filesLocation) {
+ doSetProperty("filesLocation", filesLocation);
+ return this;
+ }
+ /**
+ * The maximum size allowed for uploaded files. -1 means no limit.
+ *
+ * The option is a: <code>long</code> type.
+ *
+ * Default: -1
+ * Group: consumer (advanced)
+ *
+ * @param maxFileSize the value to set
+ * @return the dsl builder
+ */
+ default JettyComponentBuilder maxFileSize(long maxFileSize) {
+ doSetProperty("maxFileSize", maxFileSize);
+ return this;
+ }
+ /**
+ * The maximum size allowed for multipart/form-data requests. -1 means
+ * no limit.
+ *
+ * The option is a: <code>long</code> type.
+ *
+ * Default: -1
+ * Group: consumer (advanced)
+ *
+ * @param maxRequestSize the value to set
+ * @return the dsl builder
+ */
+ default JettyComponentBuilder maxRequestSize(long maxRequestSize) {
+ doSetProperty("maxRequestSize", maxRequestSize);
+ return this;
+ }
/**
* To use a custom thread pool for the server. This option should only
* be used in special circumstances.
@@ -634,6 +699,10 @@ public interface JettyComponentBuilderFactory {
case "sendServerVersion": ((JettyHttpComponent9)
component).setSendServerVersion((boolean) value); return true;
case "useContinuation": ((JettyHttpComponent9)
component).setUseContinuation((boolean) value); return true;
case "useXForwardedForHeader": ((JettyHttpComponent9)
component).setUseXForwardedForHeader((boolean) value); return true;
+ case "fileSizeThreshold": ((JettyHttpComponent9)
component).setFileSizeThreshold((int) value); return true;
+ case "filesLocation": ((JettyHttpComponent9)
component).setFilesLocation((java.lang.String) value); return true;
+ case "maxFileSize": ((JettyHttpComponent9)
component).setMaxFileSize((long) value); return true;
+ case "maxRequestSize": ((JettyHttpComponent9)
component).setMaxRequestSize((long) value); return true;
case "threadPool": ((JettyHttpComponent9)
component).setThreadPool((org.eclipse.jetty.util.thread.ThreadPool) value);
return true;
case "allowJavaSerializedObject": ((JettyHttpComponent9)
component).setAllowJavaSerializedObject((boolean) value); return true;
case "autowiredEnabled": ((JettyHttpComponent9)
component).setAutowiredEnabled((boolean) value); return true;
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JettyHttpEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JettyHttpEndpointBuilderFactory.java
index 2235f9763d6..304f482e326 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JettyHttpEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JettyHttpEndpointBuilderFactory.java
@@ -884,6 +884,58 @@ public interface JettyHttpEndpointBuilderFactory {
doSetProperty("exchangePattern", exchangePattern);
return this;
}
+ /**
+ * The size threshold after which files will be written to disk for
+ * multipart/form-data requests. By default the files are not written
to
+ * disk.
+ *
+ * The option is a: <code>java.lang.Integer</code> type.
+ *
+ * Group: consumer (advanced)
+ *
+ * @param fileSizeThreshold the value to set
+ * @return the dsl builder
+ */
+ default AdvancedJettyHttpEndpointBuilder fileSizeThreshold(
+ Integer fileSizeThreshold) {
+ doSetProperty("fileSizeThreshold", fileSizeThreshold);
+ return this;
+ }
+ /**
+ * The size threshold after which files will be written to disk for
+ * multipart/form-data requests. By default the files are not written
to
+ * disk.
+ *
+ * The option will be converted to a
+ * <code>java.lang.Integer</code> type.
+ *
+ * Group: consumer (advanced)
+ *
+ * @param fileSizeThreshold the value to set
+ * @return the dsl builder
+ */
+ default AdvancedJettyHttpEndpointBuilder fileSizeThreshold(
+ String fileSizeThreshold) {
+ doSetProperty("fileSizeThreshold", fileSizeThreshold);
+ return this;
+ }
+ /**
+ * The directory location where files will be store for
+ * multipart/form-data requests. By default the files are written in
the
+ * system temporary folder.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: consumer (advanced)
+ *
+ * @param filesLocation the value to set
+ * @return the dsl builder
+ */
+ default AdvancedJettyHttpEndpointBuilder filesLocation(
+ String filesLocation) {
+ doSetProperty("filesLocation", filesLocation);
+ return this;
+ }
/**
* Configuration of the filter init parameters. These parameters will
be
* applied to the filter list before starting the jetty server.
@@ -1110,6 +1162,68 @@ public interface JettyHttpEndpointBuilderFactory {
doSetProperty("mapHttpMessageHeaders", mapHttpMessageHeaders);
return this;
}
+ /**
+ * The maximum size allowed for uploaded files. -1 means no limit.
+ *
+ * The option is a: <code>java.lang.Long</code> type.
+ *
+ * Group: consumer (advanced)
+ *
+ * @param maxFileSize the value to set
+ * @return the dsl builder
+ */
+ default AdvancedJettyHttpEndpointBuilder maxFileSize(Long maxFileSize)
{
+ doSetProperty("maxFileSize", maxFileSize);
+ return this;
+ }
+ /**
+ * The maximum size allowed for uploaded files. -1 means no limit.
+ *
+ * The option will be converted to a
+ * <code>java.lang.Long</code> type.
+ *
+ * Group: consumer (advanced)
+ *
+ * @param maxFileSize the value to set
+ * @return the dsl builder
+ */
+ default AdvancedJettyHttpEndpointBuilder maxFileSize(String
maxFileSize) {
+ doSetProperty("maxFileSize", maxFileSize);
+ return this;
+ }
+ /**
+ * The maximum size allowed for multipart/form-data requests. -1 means
+ * no limit.
+ *
+ * The option is a: <code>java.lang.Long</code> type.
+ *
+ * Group: consumer (advanced)
+ *
+ * @param maxRequestSize the value to set
+ * @return the dsl builder
+ */
+ default AdvancedJettyHttpEndpointBuilder maxRequestSize(
+ Long maxRequestSize) {
+ doSetProperty("maxRequestSize", maxRequestSize);
+ return this;
+ }
+ /**
+ * The maximum size allowed for multipart/form-data requests. -1 means
+ * no limit.
+ *
+ * The option will be converted to a
+ * <code>java.lang.Long</code> type.
+ *
+ * Group: consumer (advanced)
+ *
+ * @param maxRequestSize the value to set
+ * @return the dsl builder
+ */
+ default AdvancedJettyHttpEndpointBuilder maxRequestSize(
+ String maxRequestSize) {
+ doSetProperty("maxRequestSize", maxRequestSize);
+ return this;
+ }
/**
* Allows using a custom multipart filter. Note: setting
* multipartFilterRef forces the value of enableMultipartFilter to
true.