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 in repository https://gitbox.apache.org/repos/asf/camel.git
commit f59fa0505f4d47c26ff3026c1e522037c195a6e1 Author: Nicolas Filotto <[email protected]> AuthorDate: Tue Nov 28 14:06:59 2023 +0100 CAMEL-20152: camel-jetty - Allow to configure the multipart --- .../org/apache/camel/catalog/components/jetty.json | 88 ++++++++++-------- .../camel/component/jetty/JettyHttpComponent.java | 69 ++++++++++++-- .../camel/component/jetty/JettyHttpEndpoint.java | 42 +++++++++ .../jetty11/JettyHttp11EndpointUriFactory.java | 6 +- .../jetty11/JettyHttpComponent11Configurer.java | 24 +++++ .../jetty11/JettyHttpEndpoint11Configurer.java | 24 +++++ .../org/apache/camel/component/jetty11/jetty.json | 88 ++++++++++-------- .../component/jetty/MultiPartFormBigFileTest.java | 102 +++++++++++++++++++++ 8 files changed, 356 insertions(+), 87 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 da8034a6399..a5cd5ba35c6 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 @@ -25,35 +25,39 @@ "bridgeErrorHandler": { "index": 0, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] "continuationTimeout": { "index": 1, "kind": "property", "displayName": "Continuation Timeout", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "30000", "description": "Allows to set a timeout in millis when using Jetty as consumer (server). By default Jetty uses 30000. You can use a value of = 0 to never expire. If a timeout o [...] "enableJmx": { "index": 2, "kind": "property", "displayName": "Enable Jmx", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is true, Jetty JMX support will be enabled for this endpoint." }, - "maxThreads": { "index": 3, "kind": "property", "displayName": "Max Threads", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To set a value for maximum number of threads in server thread pool. Notice that both a min and max size must be configured." }, - "minThreads": { "index": 4, "kind": "property", "displayName": "Min Threads", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To set a value for minimum number of threads in server thread pool. Notice that both a min and max size must be configured." }, - "muteException": { "index": 5, "kind": "property", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace." }, - "requestBufferSize": { "index": 6, "kind": "property", "displayName": "Request Buffer Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the request buffer size on the Jetty connectors." }, - "requestHeaderSize": { "index": 7, "kind": "property", "displayName": "Request Header Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the request header size on the Jetty connectors." }, - "responseBufferSize": { "index": 8, "kind": "property", "displayName": "Response Buffer Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the response buffer size on the Jetty connectors." }, - "responseHeaderSize": { "index": 9, "kind": "property", "displayName": "Response Header Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the response header size on the Jetty connectors." }, - "sendServerVersion": { "index": 10, "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 oth [...] - "useContinuation": { "index": 11, "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": { "index": 12, "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." }, - "threadPool": { "index": 13, "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": { "index": 14, "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 [...] - "autowiredEnabled": { "index": 15, "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 [...] - "errorHandler": { "index": 16, "kind": "property", "displayName": "Error Handler", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.eclipse.jetty.server.handler.ErrorHandler", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This option is used to set the ErrorHandler that Jetty server uses." }, - "httpBinding": { "index": 17, "kind": "property", "displayName": "Http Binding", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpBinding", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Not to be used - use JettyHttpBinding instead." }, - "httpConfiguration": { "index": 18, "kind": "property", "displayName": "Http Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpConfiguration", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Jetty component does not use HttpConfiguration." }, - "mbContainer": { "index": 19, "kind": "property", "displayName": "Mb Container", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.eclipse.jetty.jmx.MBeanContainer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a existing configured org.eclipse.jetty.jmx.MBeanContainer if JMX is enabled that Jetty uses for registering mbeans." }, - "headerFilterStrategy": { "index": 20, "kind": "property", "displayName": "Header Filter Strategy", "group": "filter", "label": "filter", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message." }, - "proxyHost": { "index": 21, "kind": "property", "displayName": "Proxy Host", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a http proxy to configure the hostname." }, - "proxyPort": { "index": 22, "kind": "property", "displayName": "Proxy Port", "group": "proxy", "label": "proxy", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a http proxy to configure the port number." }, - "keystore": { "index": 23, "kind": "property", "displayName": "Keystore", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "Specifies the location of the Java keystore file, which contains the Jetty server's own X.509 certificate in a key entry." }, - "socketConnectorProperties": { "index": 24, "kind": "property", "displayName": "Socket Connector Properties", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains general HTTP connector properties. Uses the same principle as sslSocketConnectorProperties." }, - "socketConnectors": { "index": 25, "kind": "property", "displayName": "Socket Connectors", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, org.eclipse.jetty.server.Connector>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains per port number specific HTTP connectors. Uses the same principle as sslSocketConnectors." }, - "sslContextParameters": { "index": 26, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters" }, - "sslKeyPassword": { "index": 27, "kind": "property", "displayName": "Ssl Key Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "The key password, which is used to access the certificate's key entry in the keystore (this is the same password that is supplied to the keystore command's -keypass option)." }, - "sslPassword": { "index": 28, "kind": "property", "displayName": "Ssl Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "The ssl password, which is required to access the keystore file (this is the same password that is supplied to the keystore command's -storepass option)." }, - "sslSocketConnectorProperties": { "index": 29, "kind": "property", "displayName": "Ssl Socket Connector Properties", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains general SSL connector properties." }, - "sslSocketConnectors": { "index": 30, "kind": "property", "displayName": "Ssl Socket Connectors", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, org.eclipse.jetty.server.Connector>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains per port number specific SSL connectors." }, - "useGlobalSslContextParameters": { "index": 31, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters" } + "fileSizeThreshold": { "index": 3, "kind": "property", "displayName": "File Size Threshold", "group": "consumer", "label": "consumer", "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": { "index": 4, "kind": "property", "displayName": "Files Location", "group": "consumer", "label": "consumer", "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": { "index": 5, "kind": "property", "displayName": "Max File Size", "group": "consumer", "label": "consumer", "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": { "index": 6, "kind": "property", "displayName": "Max Request Size", "group": "consumer", "label": "consumer", "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" }, + "maxThreads": { "index": 7, "kind": "property", "displayName": "Max Threads", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To set a value for maximum number of threads in server thread pool. Notice that both a min and max size must be configured." }, + "minThreads": { "index": 8, "kind": "property", "displayName": "Min Threads", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To set a value for minimum number of threads in server thread pool. Notice that both a min and max size must be configured." }, + "muteException": { "index": 9, "kind": "property", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace." }, + "requestBufferSize": { "index": 10, "kind": "property", "displayName": "Request Buffer Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the request buffer size on the Jetty connectors." }, + "requestHeaderSize": { "index": 11, "kind": "property", "displayName": "Request Header Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the request header size on the Jetty connectors." }, + "responseBufferSize": { "index": 12, "kind": "property", "displayName": "Response Buffer Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the response buffer size on the Jetty connectors." }, + "responseHeaderSize": { "index": 13, "kind": "property", "displayName": "Response Header Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the response header size on the Jetty connectors." }, + "sendServerVersion": { "index": 14, "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 oth [...] + "useContinuation": { "index": 15, "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": { "index": 16, "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." }, + "threadPool": { "index": 17, "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": { "index": 18, "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 [...] + "autowiredEnabled": { "index": 19, "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 [...] + "errorHandler": { "index": 20, "kind": "property", "displayName": "Error Handler", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.eclipse.jetty.server.handler.ErrorHandler", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This option is used to set the ErrorHandler that Jetty server uses." }, + "httpBinding": { "index": 21, "kind": "property", "displayName": "Http Binding", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpBinding", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Not to be used - use JettyHttpBinding instead." }, + "httpConfiguration": { "index": 22, "kind": "property", "displayName": "Http Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpConfiguration", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Jetty component does not use HttpConfiguration." }, + "mbContainer": { "index": 23, "kind": "property", "displayName": "Mb Container", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.eclipse.jetty.jmx.MBeanContainer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a existing configured org.eclipse.jetty.jmx.MBeanContainer if JMX is enabled that Jetty uses for registering mbeans." }, + "headerFilterStrategy": { "index": 24, "kind": "property", "displayName": "Header Filter Strategy", "group": "filter", "label": "filter", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message." }, + "proxyHost": { "index": 25, "kind": "property", "displayName": "Proxy Host", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a http proxy to configure the hostname." }, + "proxyPort": { "index": 26, "kind": "property", "displayName": "Proxy Port", "group": "proxy", "label": "proxy", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a http proxy to configure the port number." }, + "keystore": { "index": 27, "kind": "property", "displayName": "Keystore", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "Specifies the location of the Java keystore file, which contains the Jetty server's own X.509 certificate in a key entry." }, + "socketConnectorProperties": { "index": 28, "kind": "property", "displayName": "Socket Connector Properties", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains general HTTP connector properties. Uses the same principle as sslSocketConnectorProperties." }, + "socketConnectors": { "index": 29, "kind": "property", "displayName": "Socket Connectors", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, org.eclipse.jetty.server.Connector>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains per port number specific HTTP connectors. Uses the same principle as sslSocketConnectors." }, + "sslContextParameters": { "index": 30, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters" }, + "sslKeyPassword": { "index": 31, "kind": "property", "displayName": "Ssl Key Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "The key password, which is used to access the certificate's key entry in the keystore (this is the same password that is supplied to the keystore command's -keypass option)." }, + "sslPassword": { "index": 32, "kind": "property", "displayName": "Ssl Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "The ssl password, which is required to access the keystore file (this is the same password that is supplied to the keystore command's -storepass option)." }, + "sslSocketConnectorProperties": { "index": 33, "kind": "property", "displayName": "Ssl Socket Connector Properties", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains general SSL connector properties." }, + "sslSocketConnectors": { "index": 34, "kind": "property", "displayName": "Ssl Socket Connectors", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, org.eclipse.jetty.server.Connector>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains per port number specific SSL connectors." }, + "useGlobalSslContextParameters": { "index": 35, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters" } }, "headers": { "CamelServletContextPath": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The servlet context path used", "constantName": "org.apache.camel.component.jetty.JettyHttpConstants#SERVLET_CONTEXT_PATH" }, @@ -84,16 +88,20 @@ "eagerCheckContentAvailable": { "index": 21, "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 [...] "exceptionHandler": { "index": 22, "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 de [...] "exchangePattern": { "index": 23, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, - "filterInitParameters": { "index": 24, "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 star [...] - "filters": { "index": 25, "kind": "parameter", "displayName": "Filters", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "array", "javaType": "java.util.List<jakarta.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": { "index": 26, "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: [...] - "idleTimeout": { "index": 27, "kind": "parameter", "displayName": "Idle Timeout", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "description": "The max idle time (in milli seconds) is applied to an HTTP request for IO operations and delayed dispatch. Idle time 0 implies an infinite timeout, -1 (default) implies no HTTP channel timeout [...] - "mapHttpMessageBody": { "index": 28, "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": { "index": 29, "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 [...] - "mapHttpMessageHeaders": { "index": 30, "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." }, - "multipartFilter": { "index": 31, "kind": "parameter", "displayName": "Multipart Filter", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "jakarta.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": { "index": 32, "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": { "index": 33, "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." }, - "sslContextParameters": { "index": 34, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters" } + "fileSizeThreshold": { "index": 24, "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": { "index": 25, "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": { "index": 26, "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 star [...] + "filters": { "index": 27, "kind": "parameter", "displayName": "Filters", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "array", "javaType": "java.util.List<jakarta.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": { "index": 28, "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: [...] + "idleTimeout": { "index": 29, "kind": "parameter", "displayName": "Idle Timeout", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "description": "The max idle time (in milli seconds) is applied to an HTTP request for IO operations and delayed dispatch. Idle time 0 implies an infinite timeout, -1 (default) implies no HTTP channel timeout [...] + "mapHttpMessageBody": { "index": 30, "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": { "index": 31, "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 [...] + "mapHttpMessageHeaders": { "index": 32, "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": { "index": 33, "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": { "index": 34, "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": { "index": 35, "kind": "parameter", "displayName": "Multipart Filter", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "jakarta.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": { "index": 36, "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": { "index": 37, "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." }, + "sslContextParameters": { "index": 38, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters" } } } 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..649beee5c99 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 @@ -133,6 +133,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; protected JettyHttpComponent() { } @@ -185,6 +189,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."); @@ -261,7 +270,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 @@ -1016,6 +1028,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") + 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") + 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") + 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") + public void setFilesLocation(String filesLocation) { + this.filesLocation = filesLocation; + } + // Implementation methods // ------------------------------------------------------------------------- @@ -1142,15 +1194,20 @@ 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", ""); + boolean result = file.delete(); + if (!result) { + 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 c4209181e24..1e932ae66ec 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 @@ -85,6 +85,17 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { + " Idle time 0 implies an infinite timeout, -1 (default) implies no HTTP channel timeout and the connection timeout is used instead.") private long idleTimeout = -1; + @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; protected JettyHttpEndpoint(JettyHttpComponent component, String uri, URI httpURL) { super(uri, component, httpURL); @@ -275,4 +286,35 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { this.enableCORS = enableCORS; } + 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/jetty11/JettyHttp11EndpointUriFactory.java b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttp11EndpointUriFactory.java index e879f3cad18..354610ed9d6 100644 --- a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttp11EndpointUriFactory.java +++ b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttp11EndpointUriFactory.java @@ -21,7 +21,7 @@ public class JettyHttp11EndpointUriFactory extends org.apache.camel.support.comp private static final Set<String> SECRET_PROPERTY_NAMES; private static final Set<String> MULTI_VALUE_PREFIXES; static { - Set<String> props = new HashSet<>(35); + Set<String> props = new HashSet<>(39); props.add("async"); props.add("bridgeErrorHandler"); props.add("chunked"); @@ -33,6 +33,8 @@ public class JettyHttp11EndpointUriFactory extends org.apache.camel.support.comp props.add("enableMultipartFilter"); props.add("exceptionHandler"); props.add("exchangePattern"); + props.add("fileSizeThreshold"); + props.add("filesLocation"); props.add("filterInitParameters"); props.add("filters"); props.add("handlers"); @@ -46,6 +48,8 @@ public class JettyHttp11EndpointUriFactory extends org.apache.camel.support.comp 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/jetty11/JettyHttpComponent11Configurer.java b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttpComponent11Configurer.java index 0dff8a66e99..54299e4179d 100644 --- a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttpComponent11Configurer.java +++ b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttpComponent11Configurer.java @@ -33,6 +33,10 @@ public class JettyHttpComponent11Configurer extends PropertyConfigurerSupport im 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": @@ -40,6 +44,10 @@ public class JettyHttpComponent11Configurer extends PropertyConfigurerSupport im case "httpconfiguration": case "httpConfiguration": target.setHttpConfiguration(property(camelContext, org.apache.camel.http.common.HttpConfiguration.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": @@ -103,6 +111,10 @@ public class JettyHttpComponent11Configurer extends PropertyConfigurerSupport im 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": @@ -110,6 +122,10 @@ public class JettyHttpComponent11Configurer extends PropertyConfigurerSupport im case "httpconfiguration": case "httpConfiguration": return org.apache.camel.http.common.HttpConfiguration.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": @@ -174,6 +190,10 @@ public class JettyHttpComponent11Configurer extends PropertyConfigurerSupport im 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": @@ -181,6 +201,10 @@ public class JettyHttpComponent11Configurer extends PropertyConfigurerSupport im case "httpconfiguration": case "httpConfiguration": return target.getHttpConfiguration(); 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/jetty11/JettyHttpEndpoint11Configurer.java b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttpEndpoint11Configurer.java index e1c82dd8e0e..2b391360401 100644 --- a/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttpEndpoint11Configurer.java +++ b/components/camel-jetty/src/generated/java/org/apache/camel/component/jetty11/JettyHttpEndpoint11Configurer.java @@ -41,6 +41,10 @@ public class JettyHttpEndpoint11Configurer extends PropertyConfigurerSupport imp 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; @@ -63,6 +67,10 @@ public class JettyHttpEndpoint11Configurer extends PropertyConfigurerSupport imp 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, jakarta.servlet.Filter.class, value)); return true; case "muteexception": @@ -112,6 +120,10 @@ public class JettyHttpEndpoint11Configurer extends PropertyConfigurerSupport imp 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; @@ -134,6 +146,10 @@ public class JettyHttpEndpoint11Configurer extends PropertyConfigurerSupport imp 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 jakarta.servlet.Filter.class; case "muteexception": @@ -184,6 +200,10 @@ public class JettyHttpEndpoint11Configurer extends PropertyConfigurerSupport imp 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(); @@ -206,6 +226,10 @@ public class JettyHttpEndpoint11Configurer extends PropertyConfigurerSupport imp 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/jetty11/jetty.json b/components/camel-jetty/src/generated/resources/org/apache/camel/component/jetty11/jetty.json index da8034a6399..a5cd5ba35c6 100644 --- a/components/camel-jetty/src/generated/resources/org/apache/camel/component/jetty11/jetty.json +++ b/components/camel-jetty/src/generated/resources/org/apache/camel/component/jetty11/jetty.json @@ -25,35 +25,39 @@ "bridgeErrorHandler": { "index": 0, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] "continuationTimeout": { "index": 1, "kind": "property", "displayName": "Continuation Timeout", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "30000", "description": "Allows to set a timeout in millis when using Jetty as consumer (server). By default Jetty uses 30000. You can use a value of = 0 to never expire. If a timeout o [...] "enableJmx": { "index": 2, "kind": "property", "displayName": "Enable Jmx", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is true, Jetty JMX support will be enabled for this endpoint." }, - "maxThreads": { "index": 3, "kind": "property", "displayName": "Max Threads", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To set a value for maximum number of threads in server thread pool. Notice that both a min and max size must be configured." }, - "minThreads": { "index": 4, "kind": "property", "displayName": "Min Threads", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To set a value for minimum number of threads in server thread pool. Notice that both a min and max size must be configured." }, - "muteException": { "index": 5, "kind": "property", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace." }, - "requestBufferSize": { "index": 6, "kind": "property", "displayName": "Request Buffer Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the request buffer size on the Jetty connectors." }, - "requestHeaderSize": { "index": 7, "kind": "property", "displayName": "Request Header Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the request header size on the Jetty connectors." }, - "responseBufferSize": { "index": 8, "kind": "property", "displayName": "Response Buffer Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the response buffer size on the Jetty connectors." }, - "responseHeaderSize": { "index": 9, "kind": "property", "displayName": "Response Header Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the response header size on the Jetty connectors." }, - "sendServerVersion": { "index": 10, "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 oth [...] - "useContinuation": { "index": 11, "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": { "index": 12, "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." }, - "threadPool": { "index": 13, "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": { "index": 14, "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 [...] - "autowiredEnabled": { "index": 15, "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 [...] - "errorHandler": { "index": 16, "kind": "property", "displayName": "Error Handler", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.eclipse.jetty.server.handler.ErrorHandler", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This option is used to set the ErrorHandler that Jetty server uses." }, - "httpBinding": { "index": 17, "kind": "property", "displayName": "Http Binding", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpBinding", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Not to be used - use JettyHttpBinding instead." }, - "httpConfiguration": { "index": 18, "kind": "property", "displayName": "Http Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpConfiguration", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Jetty component does not use HttpConfiguration." }, - "mbContainer": { "index": 19, "kind": "property", "displayName": "Mb Container", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.eclipse.jetty.jmx.MBeanContainer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a existing configured org.eclipse.jetty.jmx.MBeanContainer if JMX is enabled that Jetty uses for registering mbeans." }, - "headerFilterStrategy": { "index": 20, "kind": "property", "displayName": "Header Filter Strategy", "group": "filter", "label": "filter", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message." }, - "proxyHost": { "index": 21, "kind": "property", "displayName": "Proxy Host", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a http proxy to configure the hostname." }, - "proxyPort": { "index": 22, "kind": "property", "displayName": "Proxy Port", "group": "proxy", "label": "proxy", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a http proxy to configure the port number." }, - "keystore": { "index": 23, "kind": "property", "displayName": "Keystore", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "Specifies the location of the Java keystore file, which contains the Jetty server's own X.509 certificate in a key entry." }, - "socketConnectorProperties": { "index": 24, "kind": "property", "displayName": "Socket Connector Properties", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains general HTTP connector properties. Uses the same principle as sslSocketConnectorProperties." }, - "socketConnectors": { "index": 25, "kind": "property", "displayName": "Socket Connectors", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, org.eclipse.jetty.server.Connector>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains per port number specific HTTP connectors. Uses the same principle as sslSocketConnectors." }, - "sslContextParameters": { "index": 26, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters" }, - "sslKeyPassword": { "index": 27, "kind": "property", "displayName": "Ssl Key Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "The key password, which is used to access the certificate's key entry in the keystore (this is the same password that is supplied to the keystore command's -keypass option)." }, - "sslPassword": { "index": 28, "kind": "property", "displayName": "Ssl Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "The ssl password, which is required to access the keystore file (this is the same password that is supplied to the keystore command's -storepass option)." }, - "sslSocketConnectorProperties": { "index": 29, "kind": "property", "displayName": "Ssl Socket Connector Properties", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains general SSL connector properties." }, - "sslSocketConnectors": { "index": 30, "kind": "property", "displayName": "Ssl Socket Connectors", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, org.eclipse.jetty.server.Connector>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains per port number specific SSL connectors." }, - "useGlobalSslContextParameters": { "index": 31, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters" } + "fileSizeThreshold": { "index": 3, "kind": "property", "displayName": "File Size Threshold", "group": "consumer", "label": "consumer", "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": { "index": 4, "kind": "property", "displayName": "Files Location", "group": "consumer", "label": "consumer", "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": { "index": 5, "kind": "property", "displayName": "Max File Size", "group": "consumer", "label": "consumer", "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": { "index": 6, "kind": "property", "displayName": "Max Request Size", "group": "consumer", "label": "consumer", "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" }, + "maxThreads": { "index": 7, "kind": "property", "displayName": "Max Threads", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To set a value for maximum number of threads in server thread pool. Notice that both a min and max size must be configured." }, + "minThreads": { "index": 8, "kind": "property", "displayName": "Min Threads", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To set a value for minimum number of threads in server thread pool. Notice that both a min and max size must be configured." }, + "muteException": { "index": 9, "kind": "property", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace." }, + "requestBufferSize": { "index": 10, "kind": "property", "displayName": "Request Buffer Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the request buffer size on the Jetty connectors." }, + "requestHeaderSize": { "index": 11, "kind": "property", "displayName": "Request Header Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the request header size on the Jetty connectors." }, + "responseBufferSize": { "index": 12, "kind": "property", "displayName": "Response Buffer Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the response buffer size on the Jetty connectors." }, + "responseHeaderSize": { "index": 13, "kind": "property", "displayName": "Response Header Size", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Allows to configure a custom value of the response header size on the Jetty connectors." }, + "sendServerVersion": { "index": 14, "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 oth [...] + "useContinuation": { "index": 15, "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": { "index": 16, "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." }, + "threadPool": { "index": 17, "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": { "index": 18, "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 [...] + "autowiredEnabled": { "index": 19, "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 [...] + "errorHandler": { "index": 20, "kind": "property", "displayName": "Error Handler", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.eclipse.jetty.server.handler.ErrorHandler", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This option is used to set the ErrorHandler that Jetty server uses." }, + "httpBinding": { "index": 21, "kind": "property", "displayName": "Http Binding", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpBinding", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Not to be used - use JettyHttpBinding instead." }, + "httpConfiguration": { "index": 22, "kind": "property", "displayName": "Http Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpConfiguration", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Jetty component does not use HttpConfiguration." }, + "mbContainer": { "index": 23, "kind": "property", "displayName": "Mb Container", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.eclipse.jetty.jmx.MBeanContainer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a existing configured org.eclipse.jetty.jmx.MBeanContainer if JMX is enabled that Jetty uses for registering mbeans." }, + "headerFilterStrategy": { "index": 24, "kind": "property", "displayName": "Header Filter Strategy", "group": "filter", "label": "filter", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message." }, + "proxyHost": { "index": 25, "kind": "property", "displayName": "Proxy Host", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a http proxy to configure the hostname." }, + "proxyPort": { "index": 26, "kind": "property", "displayName": "Proxy Port", "group": "proxy", "label": "proxy", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To use a http proxy to configure the port number." }, + "keystore": { "index": 27, "kind": "property", "displayName": "Keystore", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "Specifies the location of the Java keystore file, which contains the Jetty server's own X.509 certificate in a key entry." }, + "socketConnectorProperties": { "index": 28, "kind": "property", "displayName": "Socket Connector Properties", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains general HTTP connector properties. Uses the same principle as sslSocketConnectorProperties." }, + "socketConnectors": { "index": 29, "kind": "property", "displayName": "Socket Connectors", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, org.eclipse.jetty.server.Connector>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains per port number specific HTTP connectors. Uses the same principle as sslSocketConnectors." }, + "sslContextParameters": { "index": 30, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters" }, + "sslKeyPassword": { "index": 31, "kind": "property", "displayName": "Ssl Key Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "The key password, which is used to access the certificate's key entry in the keystore (this is the same password that is supplied to the keystore command's -keypass option)." }, + "sslPassword": { "index": 32, "kind": "property", "displayName": "Ssl Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "description": "The ssl password, which is required to access the keystore file (this is the same password that is supplied to the keystore command's -storepass option)." }, + "sslSocketConnectorProperties": { "index": 33, "kind": "property", "displayName": "Ssl Socket Connector Properties", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains general SSL connector properties." }, + "sslSocketConnectors": { "index": 34, "kind": "property", "displayName": "Ssl Socket Connectors", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.Integer, org.eclipse.jetty.server.Connector>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map which contains per port number specific SSL connectors." }, + "useGlobalSslContextParameters": { "index": 35, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters" } }, "headers": { "CamelServletContextPath": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The servlet context path used", "constantName": "org.apache.camel.component.jetty.JettyHttpConstants#SERVLET_CONTEXT_PATH" }, @@ -84,16 +88,20 @@ "eagerCheckContentAvailable": { "index": 21, "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 [...] "exceptionHandler": { "index": 22, "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 de [...] "exchangePattern": { "index": 23, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, - "filterInitParameters": { "index": 24, "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 star [...] - "filters": { "index": 25, "kind": "parameter", "displayName": "Filters", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "array", "javaType": "java.util.List<jakarta.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": { "index": 26, "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: [...] - "idleTimeout": { "index": 27, "kind": "parameter", "displayName": "Idle Timeout", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "description": "The max idle time (in milli seconds) is applied to an HTTP request for IO operations and delayed dispatch. Idle time 0 implies an infinite timeout, -1 (default) implies no HTTP channel timeout [...] - "mapHttpMessageBody": { "index": 28, "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": { "index": 29, "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 [...] - "mapHttpMessageHeaders": { "index": 30, "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." }, - "multipartFilter": { "index": 31, "kind": "parameter", "displayName": "Multipart Filter", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "jakarta.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": { "index": 32, "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": { "index": 33, "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." }, - "sslContextParameters": { "index": 34, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters" } + "fileSizeThreshold": { "index": 24, "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": { "index": 25, "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": { "index": 26, "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 star [...] + "filters": { "index": 27, "kind": "parameter", "displayName": "Filters", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "array", "javaType": "java.util.List<jakarta.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": { "index": 28, "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: [...] + "idleTimeout": { "index": 29, "kind": "parameter", "displayName": "Idle Timeout", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "description": "The max idle time (in milli seconds) is applied to an HTTP request for IO operations and delayed dispatch. Idle time 0 implies an infinite timeout, -1 (default) implies no HTTP channel timeout [...] + "mapHttpMessageBody": { "index": 30, "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": { "index": 31, "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 [...] + "mapHttpMessageHeaders": { "index": 32, "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": { "index": 33, "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": { "index": 34, "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": { "index": 35, "kind": "parameter", "displayName": "Multipart Filter", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "jakarta.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": { "index": 36, "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": { "index": 37, "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." }, + "sslContextParameters": { "index": 38, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters" } } } 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..4277f4922ee --- /dev/null +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormBigFileTest.java @@ -0,0 +1,102 @@ +/* + * 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 jakarta.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.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.HttpEntity; +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 { + HttpPost post = new HttpPost("http://localhost:" + getPort() + "/test"); + post.setEntity(createMultipartRequestEntityWithBigFile()); + try (CloseableHttpClient client = HttpClients.createDefault(); + CloseableHttpResponse response = client.execute(post)) { + int status = response.getCode(); + + 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); + } + } + + }); + } + }; + } +}
