This is an automated email from the ASF dual-hosted git repository.
zhfeng pushed a commit to branch camel-4.10.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.10.x by this push:
new ab48ba8df5b CAMEL-21884: camel-platform-http - Introduce
useBodyHandler option (#17528) (#17624)
ab48ba8df5b is described below
commit ab48ba8df5b40ab6e34d413f277b1f49b1c351c0
Author: Zheng Feng <[email protected]>
AuthorDate: Tue Apr 1 14:51:29 2025 +0800
CAMEL-21884: camel-platform-http - Introduce useBodyHandler option (#17528)
(#17624)
---
.../camel/catalog/components/platform-http.json | 17 +++--
components/camel-platform-http-vertx/pom.xml | 5 ++
.../http/vertx/DefaultHttpRequestBodyHandler.java | 3 +-
...andler.java => NoOpHttpRequestBodyHandler.java} | 18 +----
.../http/vertx/VertxPlatformHttpConsumer.java | 6 +-
.../component/platform/http/vertx/PathCreator.java | 25 +++++++
.../vertx/VertxPlatformHttpNoBodyHandlerTest.java | 86 ++++++++++++++++++++++
.../http/PlatformHttpEndpointConfigurer.java | 6 ++
.../http/PlatformHttpEndpointUriFactory.java | 3 +-
.../component/platform/http/platform-http.json | 17 +++--
.../platform/http/PlatformHttpEndpoint.java | 12 +++
.../dsl/PlatformHttpEndpointBuilderFactory.java | 32 ++++++++
12 files changed, 197 insertions(+), 33 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
index bdda90c3a46..4e2491243c1 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
@@ -47,13 +47,14 @@
"populateBodyWithForm": { "index": 12, "kind": "parameter", "displayName":
"Populate Body With Form", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether to populate the message Body with a Map containing
application\/x-www-form-urlencoded form properties." },
"produces": { "index": 13, "kind": "parameter", "displayName": "Produces",
"group": "consumer", "label": "consumer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The content type this endpoint produces, such
as application\/xml or application\/json." },
"returnHttpRequestHeaders": { "index": 14, "kind": "parameter",
"displayName": "Return Http Request Headers", "group": "consumer", "label":
"advanced,consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to include HTTP request headers
(Accept, User-Agent, etc.) into HTTP response produced by this endpoint." },
- "useCookieHandler": { "index": 15, "kind": "parameter", "displayName":
"Use Cookie Handler", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to enable the Cookie Handler that allows Cookie
addition, expiry, and retrieval (currently only supported by
camel-platform-http-vertx)" },
- "useStreaming": { "index": 16, "kind": "parameter", "displayName": "Use
Streaming", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to use streaming for large requests and responses (currently only
supported by camel-platform-http-vertx)" },
- "bridgeErrorHandler": { "index": 17, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "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 [...]
- "exceptionHandler": { "index": 18, "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": 19, "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." },
- "fileNameExtWhitelist": { "index": 20, "kind": "parameter", "displayName":
"File Name Ext Whitelist", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A comma or whitespace separated list of file extensions.
Uploads having these extensions will be stored locally. Null value or asterisk
() will allow all files." },
- "headerFilterStrategy": { "index": 21, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter headers to and from Camel message." },
- "platformHttpEngine": { "index": 22, "kind": "parameter", "displayName":
"Platform Http Engine", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests of this endpoint." }
+ "useBodyHandler": { "index": 15, "kind": "parameter", "displayName": "Use
Body Handler", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to use BodyHandler for the request. If set to false then the request
will no be read and parsed." },
+ "useCookieHandler": { "index": 16, "kind": "parameter", "displayName":
"Use Cookie Handler", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to enable the Cookie Handler that allows Cookie
addition, expiry, and retrieval (currently only supported by
camel-platform-http-vertx)" },
+ "useStreaming": { "index": 17, "kind": "parameter", "displayName": "Use
Streaming", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to use streaming for large requests and responses (currently only
supported by camel-platform-http-vertx)" },
+ "bridgeErrorHandler": { "index": 18, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "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 [...]
+ "exceptionHandler": { "index": 19, "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": 20, "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." },
+ "fileNameExtWhitelist": { "index": 21, "kind": "parameter", "displayName":
"File Name Ext Whitelist", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A comma or whitespace separated list of file extensions.
Uploads having these extensions will be stored locally. Null value or asterisk
() will allow all files." },
+ "headerFilterStrategy": { "index": 22, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter headers to and from Camel message." },
+ "platformHttpEngine": { "index": 23, "kind": "parameter", "displayName":
"Platform Http Engine", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests of this endpoint." }
}
}
diff --git a/components/camel-platform-http-vertx/pom.xml
b/components/camel-platform-http-vertx/pom.xml
index 53c54e36593..b4834c7c5e9 100644
--- a/components/camel-platform-http-vertx/pom.xml
+++ b/components/camel-platform-http-vertx/pom.xml
@@ -89,6 +89,11 @@
<artifactId>camel-rest-openapi</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-vertx-http</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
diff --git
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/DefaultHttpRequestBodyHandler.java
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/DefaultHttpRequestBodyHandler.java
index 4f187da7f0a..eb69364bcab 100644
---
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/DefaultHttpRequestBodyHandler.java
+++
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/DefaultHttpRequestBodyHandler.java
@@ -27,7 +27,8 @@ import static
org.apache.camel.component.platform.http.vertx.VertxPlatformHttpSu
import static
org.apache.camel.component.platform.http.vertx.VertxPlatformHttpSupport.isMultiPartFormData;
/**
- * Default {@link HttpRequestBodyHandler} that will read to read the entire
HTTP request body into memory.
+ * Default {@link HttpRequestBodyHandler} that will read the entire HTTP
request body into memory if useBodyHandler is
+ * enabled.
*/
class DefaultHttpRequestBodyHandler extends HttpRequestBodyHandler {
DefaultHttpRequestBodyHandler(Handler<RoutingContext> delegate) {
diff --git
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/DefaultHttpRequestBodyHandler.java
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/NoOpHttpRequestBodyHandler.java
similarity index 62%
copy from
components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/DefaultHttpRequestBodyHandler.java
copy to
components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/NoOpHttpRequestBodyHandler.java
index 4f187da7f0a..1a7f5d9177c 100644
---
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/DefaultHttpRequestBodyHandler.java
+++
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/NoOpHttpRequestBodyHandler.java
@@ -18,33 +18,23 @@ package org.apache.camel.component.platform.http.vertx;
import io.vertx.core.Future;
import io.vertx.core.Handler;
-import io.vertx.ext.web.RequestBody;
import io.vertx.ext.web.Route;
import io.vertx.ext.web.RoutingContext;
import org.apache.camel.Message;
-import static
org.apache.camel.component.platform.http.vertx.VertxPlatformHttpSupport.isFormUrlEncoded;
-import static
org.apache.camel.component.platform.http.vertx.VertxPlatformHttpSupport.isMultiPartFormData;
-
-/**
- * Default {@link HttpRequestBodyHandler} that will read to read the entire
HTTP request body into memory.
- */
-class DefaultHttpRequestBodyHandler extends HttpRequestBodyHandler {
- DefaultHttpRequestBodyHandler(Handler<RoutingContext> delegate) {
+class NoOpHttpRequestBodyHandler extends HttpRequestBodyHandler {
+ NoOpHttpRequestBodyHandler(final Handler<RoutingContext> delegate) {
super(delegate);
}
@Override
void configureRoute(Route route) {
- route.handler(delegate);
}
@Override
Future<Void> handle(RoutingContext routingContext, Message message) {
- if (!isMultiPartFormData(routingContext) &&
!isFormUrlEncoded(routingContext)) {
- final RequestBody requestBody = routingContext.body();
- message.setBody(requestBody.buffer());
- }
+ routingContext.request().pause();
+ message.setBody(routingContext.request());
return Future.succeededFuture();
}
}
diff --git
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
index 11472ee6265..05b77e1dce8 100644
---
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
+++
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
@@ -110,6 +110,8 @@ public class VertxPlatformHttpConsumer extends
DefaultConsumer
router =
VertxPlatformHttpRouter.lookup(getEndpoint().getCamelContext());
if (!getEndpoint().isHttpProxy() && getEndpoint().isUseStreaming()) {
httpRequestBodyHandler = new
StreamingHttpRequestBodyHandler(router.bodyHandler());
+ } else if (!getEndpoint().isHttpProxy() &&
!getEndpoint().isUseBodyHandler()) {
+ httpRequestBodyHandler = new
NoOpHttpRequestBodyHandler(router.bodyHandler());
} else {
httpRequestBodyHandler = new
DefaultHttpRequestBodyHandler(router.bodyHandler());
}
@@ -212,7 +214,9 @@ public class VertxPlatformHttpConsumer extends
DefaultConsumer
handleProxy(ctx, exchange);
}
- populateMultiFormData(ctx, exchange.getIn(),
getEndpoint().getHeaderFilterStrategy());
+ if (getEndpoint().isUseBodyHandler()) {
+ populateMultiFormData(ctx, exchange.getIn(),
getEndpoint().getHeaderFilterStrategy());
+ }
vertx.executeBlocking(() -> processExchange(exchange),
false).onComplete(processExchangeResult -> {
if (processExchangeResult.succeeded()) {
diff --git
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PathCreator.java
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PathCreator.java
new file mode 100644
index 00000000000..c65bc9499f8
--- /dev/null
+++
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PathCreator.java
@@ -0,0 +1,25 @@
+/*
+ * 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.platform.http.vertx;
+
+import org.apache.commons.lang3.StringUtils;
+
+public class PathCreator {
+ public String createNewUri(String uri) {
+ return "vertx-http:" + StringUtils.replaceOnce(uri, "/camel", "");
+ }
+}
diff --git
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpNoBodyHandlerTest.java
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpNoBodyHandlerTest.java
new file mode 100644
index 00000000000..5c3a9146e04
--- /dev/null
+++
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpNoBodyHandlerTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.platform.http.vertx;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.AvailablePortFinder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static
com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.is;
+
+public class VertxPlatformHttpNoBodyHandlerTest {
+ private final int port = AvailablePortFinder.getNextAvailable();
+ private final WireMockServer wireMockServer = new
WireMockServer(options().port(port));
+
+ @BeforeEach
+ void before() {
+ wireMockServer.stubFor(post(urlPathEqualTo("/test"))
+ .withRequestBody(containing("Hello World"))
+ .willReturn(aResponse()
+ .withBody("This is a test")));
+
+ wireMockServer.start();
+ }
+
+ @AfterEach
+ void after() {
+ if (wireMockServer != null) {
+ wireMockServer.stop();
+ }
+ }
+
+ @Test
+ void testNoBodyHandler() throws Exception {
+ final CamelContext context =
VertxPlatformHttpEngineTest.createCamelContext();
+ final var mockUrl = "http://localhost:" + wireMockServer.port();
+
+ try {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+
from("platform-http:/camel?matchOnUriPrefix=true&useBodyHandler=false")
+ .removeHeader("CamelHttpUri")
+ .setHeader("OrgCamelHttpUri", simple(mockUrl +
"${header.CamelHttpPath}"))
+ .setHeader("CamelHttpPath", simple(""))
+ .toD("${bean:" + PathCreator.class.getName()
+ +
"?method=createNewUri(${header.OrgCamelHttpUri})}?bridgeEndpoint=true");
+ }
+ });
+
+ context.start();
+
+ given()
+ .body("Hello World")
+ .post("/camel/test")
+ .then()
+ .statusCode(200)
+ .body(is("This is a test"));
+ } finally {
+ context.stop();
+ }
+ }
+}
diff --git
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
index 1512d8a2150..1d419ff5be5 100644
---
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
+++
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
@@ -61,6 +61,8 @@ public class PlatformHttpEndpointConfigurer extends
PropertyConfigurerSupport im
case "produces": target.setProduces(property(camelContext,
java.lang.String.class, value)); return true;
case "returnhttprequestheaders":
case "returnHttpRequestHeaders":
target.setReturnHttpRequestHeaders(property(camelContext, boolean.class,
value)); return true;
+ case "usebodyhandler":
+ case "useBodyHandler": target.setUseBodyHandler(property(camelContext,
boolean.class, value)); return true;
case "usecookiehandler":
case "useCookieHandler":
target.setUseCookieHandler(property(camelContext, boolean.class, value));
return true;
case "usestreaming":
@@ -110,6 +112,8 @@ public class PlatformHttpEndpointConfigurer extends
PropertyConfigurerSupport im
case "produces": return java.lang.String.class;
case "returnhttprequestheaders":
case "returnHttpRequestHeaders": return boolean.class;
+ case "usebodyhandler":
+ case "useBodyHandler": return boolean.class;
case "usecookiehandler":
case "useCookieHandler": return boolean.class;
case "usestreaming":
@@ -160,6 +164,8 @@ public class PlatformHttpEndpointConfigurer extends
PropertyConfigurerSupport im
case "produces": return target.getProduces();
case "returnhttprequestheaders":
case "returnHttpRequestHeaders": return
target.isReturnHttpRequestHeaders();
+ case "usebodyhandler":
+ case "useBodyHandler": return target.isUseBodyHandler();
case "usecookiehandler":
case "useCookieHandler": return target.isUseCookieHandler();
case "usestreaming":
diff --git
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointUriFactory.java
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointUriFactory.java
index 3a6665fbf83..feb2ab4bf49 100644
---
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointUriFactory.java
+++
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointUriFactory.java
@@ -23,7 +23,7 @@ public class PlatformHttpEndpointUriFactory extends
org.apache.camel.support.com
private static final Set<String> SECRET_PROPERTY_NAMES;
private static final Set<String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(23);
+ Set<String> props = new HashSet<>(24);
props.add("bridgeErrorHandler");
props.add("consumes");
props.add("cookieDomain");
@@ -45,6 +45,7 @@ public class PlatformHttpEndpointUriFactory extends
org.apache.camel.support.com
props.add("populateBodyWithForm");
props.add("produces");
props.add("returnHttpRequestHeaders");
+ props.add("useBodyHandler");
props.add("useCookieHandler");
props.add("useStreaming");
PROPERTY_NAMES = Collections.unmodifiableSet(props);
diff --git
a/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
b/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
index bdda90c3a46..4e2491243c1 100644
---
a/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
+++
b/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
@@ -47,13 +47,14 @@
"populateBodyWithForm": { "index": 12, "kind": "parameter", "displayName":
"Populate Body With Form", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether to populate the message Body with a Map containing
application\/x-www-form-urlencoded form properties." },
"produces": { "index": 13, "kind": "parameter", "displayName": "Produces",
"group": "consumer", "label": "consumer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The content type this endpoint produces, such
as application\/xml or application\/json." },
"returnHttpRequestHeaders": { "index": 14, "kind": "parameter",
"displayName": "Return Http Request Headers", "group": "consumer", "label":
"advanced,consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to include HTTP request headers
(Accept, User-Agent, etc.) into HTTP response produced by this endpoint." },
- "useCookieHandler": { "index": 15, "kind": "parameter", "displayName":
"Use Cookie Handler", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to enable the Cookie Handler that allows Cookie
addition, expiry, and retrieval (currently only supported by
camel-platform-http-vertx)" },
- "useStreaming": { "index": 16, "kind": "parameter", "displayName": "Use
Streaming", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to use streaming for large requests and responses (currently only
supported by camel-platform-http-vertx)" },
- "bridgeErrorHandler": { "index": 17, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "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 [...]
- "exceptionHandler": { "index": 18, "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": 19, "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." },
- "fileNameExtWhitelist": { "index": 20, "kind": "parameter", "displayName":
"File Name Ext Whitelist", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A comma or whitespace separated list of file extensions.
Uploads having these extensions will be stored locally. Null value or asterisk
() will allow all files." },
- "headerFilterStrategy": { "index": 21, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter headers to and from Camel message." },
- "platformHttpEngine": { "index": 22, "kind": "parameter", "displayName":
"Platform Http Engine", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests of this endpoint." }
+ "useBodyHandler": { "index": 15, "kind": "parameter", "displayName": "Use
Body Handler", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to use BodyHandler for the request. If set to false then the request
will no be read and parsed." },
+ "useCookieHandler": { "index": 16, "kind": "parameter", "displayName":
"Use Cookie Handler", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to enable the Cookie Handler that allows Cookie
addition, expiry, and retrieval (currently only supported by
camel-platform-http-vertx)" },
+ "useStreaming": { "index": 17, "kind": "parameter", "displayName": "Use
Streaming", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to use streaming for large requests and responses (currently only
supported by camel-platform-http-vertx)" },
+ "bridgeErrorHandler": { "index": 18, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "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 [...]
+ "exceptionHandler": { "index": 19, "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": 20, "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." },
+ "fileNameExtWhitelist": { "index": 21, "kind": "parameter", "displayName":
"File Name Ext Whitelist", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A comma or whitespace separated list of file extensions.
Uploads having these extensions will be stored locally. Null value or asterisk
() will allow all files." },
+ "headerFilterStrategy": { "index": 22, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter headers to and from Camel message." },
+ "platformHttpEngine": { "index": 23, "kind": "parameter", "displayName":
"Platform Http Engine", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests of this endpoint." }
}
}
diff --git
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
index 5c837e20c56..3c26d688132 100644
---
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
+++
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
@@ -129,6 +129,10 @@ public class PlatformHttpEndpoint extends DefaultEndpoint
description = "Whether to populate the message Body with a Map
containing application/x-www-form-urlencoded form properties.")
private boolean populateBodyWithForm = true;
+ @UriParam(label = "advanced,consumer", defaultValue = "true",
+ description = "Whether to use BodyHandler for the request. If
set to false then the request will no be read and parsed.")
+ private boolean useBodyHandler = true;
+
public PlatformHttpEndpoint(String uri, String remaining, Component
component) {
super(uri, component);
path = remaining;
@@ -320,4 +324,12 @@ public class PlatformHttpEndpoint extends DefaultEndpoint
public void setPopulateBodyWithForm(boolean populateBodyWithForm) {
this.populateBodyWithForm = populateBodyWithForm;
}
+
+ public boolean isUseBodyHandler() {
+ return useBodyHandler;
+ }
+
+ public void setUseBodyHandler(final boolean useBodyHandler) {
+ this.useBodyHandler = useBodyHandler;
+ }
}
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
index b7a3431b3f8..dc1633ce15e 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
@@ -425,6 +425,38 @@ public interface PlatformHttpEndpointBuilderFactory {
doSetProperty("returnHttpRequestHeaders",
returnHttpRequestHeaders);
return this;
}
+ /**
+ * Whether to use BodyHandler for the request. If set to false then the
+ * request will no be read and parsed.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: true
+ * Group: consumer
+ *
+ * @param useBodyHandler the value to set
+ * @return the dsl builder
+ */
+ default AdvancedPlatformHttpEndpointBuilder useBodyHandler(boolean
useBodyHandler) {
+ doSetProperty("useBodyHandler", useBodyHandler);
+ return this;
+ }
+ /**
+ * Whether to use BodyHandler for the request. If set to false then the
+ * request will no be read and parsed.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: true
+ * Group: consumer
+ *
+ * @param useBodyHandler the value to set
+ * @return the dsl builder
+ */
+ default AdvancedPlatformHttpEndpointBuilder useBodyHandler(String
useBodyHandler) {
+ doSetProperty("useBodyHandler", useBodyHandler);
+ return this;
+ }
/**
* Whether to enable the Cookie Handler that allows Cookie addition,
* expiry, and retrieval (currently only supported by