This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 04453e0 CAMEL-16220: camel-vertx-http - optimize producer with option
to control the response payload
04453e0 is described below
commit 04453e0407b414025392b96991db4dc532645807
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Feb 17 09:33:44 2021 +0100
CAMEL-16220: camel-vertx-http - optimize producer with option to control
the response payload
---
.../camel/catalog/docs/vertx-http-component.adoc | 6 ++--
.../vertx/http/VertxBufferConverterLoader.java | 2 ++
.../vertx/http/VertxHttpComponentConfigurer.java | 6 ++++
.../vertx/http/VertxHttpEndpointConfigurer.java | 6 ++++
.../vertx/http/VertxHttpEndpointUriFactory.java | 3 +-
.../camel/component/vertx/http/vertx-http.json | 2 ++
.../src/main/docs/vertx-http-component.adoc | 6 ++--
.../vertx/http/DefaultVertxHttpBinding.java | 6 +++-
.../component/vertx/http/VertxBufferConverter.java | 6 ++++
.../component/vertx/http/VertxHttpComponent.java | 15 +++++++++-
.../vertx/http/VertxHttpConfiguration.java | 13 ++++++++
.../dsl/VertxHttpComponentBuilderFactory.java | 18 +++++++++++
.../dsl/VertxHttpEndpointBuilderFactory.java | 35 ++++++++++++++++++++++
.../modules/ROOT/pages/vertx-http-component.adoc | 6 ++--
14 files changed, 121 insertions(+), 9 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-http-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-http-component.adoc
index 740ebd1..b477dfa 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-http-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-http-component.adoc
@@ -37,7 +37,7 @@ vertx-http:hostname[:port][/resourceUri][?options]
== Options
// component options: START
-The Vert.x HTTP Client component supports 17 options, which are listed below.
+The Vert.x HTTP Client component supports 18 options, which are listed below.
@@ -45,6 +45,7 @@ The Vert.x HTTP Client component supports 17 options, which
are listed below.
|===
| Name | Description | Default | Type
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
+| *responsePayloadAsByteArray* (producer) | Whether the response body should
be byte or as io.vertx.core.buffer.Buffer | true | boolean
| *allowJavaSerializedObject* (advanced) | Whether to allow java serialization
when a request has the Content-Type application/x-java-serialized-object This
is disabled by default. If you enable this, be aware that Java will deserialize
the incoming data from the request. This can be a potential security risk. |
false | boolean
| *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used
for automatic autowiring options (the option must be marked as autowired) by
looking up in the registry to find if there is a single instance of matching
type, which then gets configured on the component. This can be used for
automatic configuring JDBC data sources, JMS connection factories, AWS Clients,
etc. | true | boolean
| *vertx* (advanced) | To use an existing vertx instead of creating a new
instance | | Vertx
@@ -83,7 +84,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (22 parameters):
+=== Query Parameters (23 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -95,6 +96,7 @@ with the following path and query parameters:
| *httpMethod* (producer) | The HTTP method to use. The HttpMethod header
cannot override this option if set. There are 10 enums and the value can be one
of: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PATCH, OTHER | |
HttpMethod
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
| *okStatusCodeRange* (producer) | The status codes which are considered a
success response. The values are inclusive. Multiple ranges can be defined,
separated by comma, e.g. 200-204,209,301-304. Each range must be a single
number or from-to with the dash included | 200-299 | String
+| *responsePayloadAsByteArray* (producer) | Whether the response body should
be byte or as io.vertx.core.buffer.Buffer | true | boolean
| *sessionManagement* (producer) | Enables session management via
WebClientSession. By default the client is configured to use an in-memory
CookieStore. The cookieStore option can be used to override this | false |
boolean
| *throwExceptionOnFailure* (producer) | Disable throwing
HttpOperationFailedException in case of failed responses from the remote server
| true | boolean
| *timeout* (producer) | The amount of time in milliseconds after which if the
request does not return any data within the timeout period a TimeoutException
fails the request. Setting zero or a negative value disables the timeout. | -1
| long
diff --git
a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxBufferConverterLoader.java
b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxBufferConverterLoader.java
index 2e2bf5f..9329a83 100644
---
a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxBufferConverterLoader.java
+++
b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxBufferConverterLoader.java
@@ -35,6 +35,8 @@ public final class VertxBufferConverterLoader implements
TypeConverterLoader {
(type, exchange, value) ->
org.apache.camel.component.vertx.http.VertxBufferConverter.toBuffer((java.io.InputStream)
value));
addTypeConverter(registry, io.vertx.core.buffer.Buffer.class,
java.lang.String.class, false,
(type, exchange, value) ->
org.apache.camel.component.vertx.http.VertxBufferConverter.toBuffer((java.lang.String)
value, exchange));
+ addTypeConverter(registry, java.io.InputStream.class,
io.vertx.core.buffer.Buffer.class, false,
+ (type, exchange, value) ->
org.apache.camel.component.vertx.http.VertxBufferConverter.toInputStream((io.vertx.core.buffer.Buffer)
value));
addTypeConverter(registry, java.lang.String.class,
io.vertx.core.buffer.Buffer.class, false,
(type, exchange, value) ->
org.apache.camel.component.vertx.http.VertxBufferConverter.toString((io.vertx.core.buffer.Buffer)
value, exchange));
}
diff --git
a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpComponentConfigurer.java
b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpComponentConfigurer.java
index e39424a..aa157f2 100644
---
a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpComponentConfigurer.java
+++
b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpComponentConfigurer.java
@@ -45,6 +45,8 @@ public class VertxHttpComponentConfigurer extends
PropertyConfigurerSupport impl
case "proxyType": target.setProxyType(property(camelContext,
io.vertx.core.net.ProxyType.class, value)); return true;
case "proxyusername":
case "proxyUsername": target.setProxyUsername(property(camelContext,
java.lang.String.class, value)); return true;
+ case "responsepayloadasbytearray":
+ case "responsePayloadAsByteArray":
target.setResponsePayloadAsByteArray(property(camelContext, boolean.class,
value)); return true;
case "sslcontextparameters":
case "sslContextParameters":
target.setSslContextParameters(property(camelContext,
org.apache.camel.support.jsse.SSLContextParameters.class, value)); return true;
case "useglobalsslcontextparameters":
@@ -85,6 +87,8 @@ public class VertxHttpComponentConfigurer extends
PropertyConfigurerSupport impl
case "proxyType": return io.vertx.core.net.ProxyType.class;
case "proxyusername":
case "proxyUsername": return java.lang.String.class;
+ case "responsepayloadasbytearray":
+ case "responsePayloadAsByteArray": return boolean.class;
case "sslcontextparameters":
case "sslContextParameters": return
org.apache.camel.support.jsse.SSLContextParameters.class;
case "useglobalsslcontextparameters":
@@ -126,6 +130,8 @@ public class VertxHttpComponentConfigurer extends
PropertyConfigurerSupport impl
case "proxyType": return target.getProxyType();
case "proxyusername":
case "proxyUsername": return target.getProxyUsername();
+ case "responsepayloadasbytearray":
+ case "responsePayloadAsByteArray": return
target.isResponsePayloadAsByteArray();
case "sslcontextparameters":
case "sslContextParameters": return target.getSslContextParameters();
case "useglobalsslcontextparameters":
diff --git
a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpEndpointConfigurer.java
b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpEndpointConfigurer.java
index f230132..e887e06 100644
---
a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpEndpointConfigurer.java
+++
b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpEndpointConfigurer.java
@@ -49,6 +49,8 @@ public class VertxHttpEndpointConfigurer extends
PropertyConfigurerSupport imple
case "proxyType":
target.getConfiguration().setProxyType(property(camelContext,
io.vertx.core.net.ProxyType.class, value)); return true;
case "proxyusername":
case "proxyUsername":
target.getConfiguration().setProxyUsername(property(camelContext,
java.lang.String.class, value)); return true;
+ case "responsepayloadasbytearray":
+ case "responsePayloadAsByteArray":
target.getConfiguration().setResponsePayloadAsByteArray(property(camelContext,
boolean.class, value)); return true;
case "sessionmanagement":
case "sessionManagement":
target.getConfiguration().setSessionManagement(property(camelContext,
boolean.class, value)); return true;
case "sslcontextparameters":
@@ -99,6 +101,8 @@ public class VertxHttpEndpointConfigurer extends
PropertyConfigurerSupport imple
case "proxyType": return io.vertx.core.net.ProxyType.class;
case "proxyusername":
case "proxyUsername": return java.lang.String.class;
+ case "responsepayloadasbytearray":
+ case "responsePayloadAsByteArray": return boolean.class;
case "sessionmanagement":
case "sessionManagement": return boolean.class;
case "sslcontextparameters":
@@ -150,6 +154,8 @@ public class VertxHttpEndpointConfigurer extends
PropertyConfigurerSupport imple
case "proxyType": return target.getConfiguration().getProxyType();
case "proxyusername":
case "proxyUsername": return
target.getConfiguration().getProxyUsername();
+ case "responsepayloadasbytearray":
+ case "responsePayloadAsByteArray": return
target.getConfiguration().isResponsePayloadAsByteArray();
case "sessionmanagement":
case "sessionManagement": return
target.getConfiguration().isSessionManagement();
case "sslcontextparameters":
diff --git
a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpEndpointUriFactory.java
b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpEndpointUriFactory.java
index 639330b..9895976 100644
---
a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpEndpointUriFactory.java
+++
b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpEndpointUriFactory.java
@@ -20,7 +20,7 @@ public class VertxHttpEndpointUriFactory extends
org.apache.camel.support.compon
private static final Set<String> PROPERTY_NAMES;
private static final Set<String> SECRET_PROPERTY_NAMES;
static {
- Set<String> props = new HashSet<>(23);
+ Set<String> props = new HashSet<>(24);
props.add("throwExceptionOnFailure");
props.add("proxyUsername");
props.add("sessionManagement");
@@ -33,6 +33,7 @@ public class VertxHttpEndpointUriFactory extends
org.apache.camel.support.compon
props.add("useCompression");
props.add("vertxHttpBinding");
props.add("okStatusCodeRange");
+ props.add("responsePayloadAsByteArray");
props.add("proxyHost");
props.add("timeout");
props.add("proxyPort");
diff --git
a/components/camel-vertx-http/src/generated/resources/org/apache/camel/component/vertx/http/vertx-http.json
b/components/camel-vertx-http/src/generated/resources/org/apache/camel/component/vertx/http/vertx-http.json
index 852e081..069eb8c 100644
---
a/components/camel-vertx-http/src/generated/resources/org/apache/camel/component/vertx/http/vertx-http.json
+++
b/components/camel-vertx-http/src/generated/resources/org/apache/camel/component/vertx/http/vertx-http.json
@@ -23,6 +23,7 @@
},
"componentProperties": {
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether the producer
should be started lazy (on the first message). By starting lazy you can use
this to allow CamelContext and routes to startup in situations where a producer
may otherwise fail during star [...]
+ "responsePayloadAsByteArray": { "kind": "property", "displayName":
"Response Payload As Byte Array", "group": "producer", "label": "producer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether the response body should be byte or as
io.vertx.core.buffer.Buffer" },
"allowJavaSerializedObject": { "kind": "property", "displayName": "Allow
Java Serialized Object", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to allow java serialization when a request has the Content-Type
application\/x-java-serialized-object This is disabled by default. If you
enable this, be aware that Java will deseria [...]
"autowiredEnabled": { "kind": "property", "displayName": "Autowired
Enabled", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether autowiring is
enabled. This is used for automatic autowiring options (the option must be
marked as autowired) by looking up in the registry to find if there is a single
instance of matching type, which t [...]
"vertx": { "kind": "property", "displayName": "Vertx", "group":
"advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "io.vertx.core.Vertx", "deprecated": false, "autowired": false,
"secret": false, "description": "To use an existing vertx instead of creating a
new instance" },
@@ -48,6 +49,7 @@
"httpMethod": { "kind": "parameter", "displayName": "Http Method",
"group": "producer", "label": "producer", "required": false, "type": "object",
"javaType": "io.vertx.core.http.HttpMethod", "enum": [ "OPTIONS", "GET",
"HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT", "PATCH", "OTHER" ],
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.http.VertxHttpConfiguration",
"configurationField": "configuration", "description" [...]
"lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether the producer
should be started lazy (on the first message). By starting lazy you can use
this to allow CamelContext and routes to startup in situations where a producer
may otherwise fail during sta [...]
"okStatusCodeRange": { "kind": "parameter", "displayName": "Ok Status Code
Range", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "200-299", "configurationClass":
"org.apache.camel.component.vertx.http.VertxHttpConfiguration",
"configurationField": "configuration", "description": "The status codes which
are considered a success response. The values [...]
+ "responsePayloadAsByteArray": { "kind": "parameter", "displayName":
"Response Payload As Byte Array", "group": "producer", "label": "producer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"configurationClass":
"org.apache.camel.component.vertx.http.VertxHttpConfiguration",
"configurationField": "configuration", "description": "Whether the response
body should be byte or as io.vertx.core.b [...]
"sessionManagement": { "kind": "parameter", "displayName": "Session
Management", "group": "producer", "label": "producer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.http.VertxHttpConfiguration",
"configurationField": "configuration", "description": "Enables session
management via WebClientSession. By default the client is configur [...]
"throwExceptionOnFailure": { "kind": "parameter", "displayName": "Throw
Exception On Failure", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true,
"configurationClass":
"org.apache.camel.component.vertx.http.VertxHttpConfiguration",
"configurationField": "configuration", "description": "Disable throwing
HttpOperationFailedException in case of failed respo [...]
"timeout": { "kind": "parameter", "displayName": "Timeout", "group":
"producer", "label": "producer", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": -1, "configurationClass":
"org.apache.camel.component.vertx.http.VertxHttpConfiguration",
"configurationField": "configuration", "description": "The amount of time in
milliseconds after which if the request does not return any data within the
timeout per [...]
diff --git
a/components/camel-vertx-http/src/main/docs/vertx-http-component.adoc
b/components/camel-vertx-http/src/main/docs/vertx-http-component.adoc
index 740ebd1..b477dfa 100644
--- a/components/camel-vertx-http/src/main/docs/vertx-http-component.adoc
+++ b/components/camel-vertx-http/src/main/docs/vertx-http-component.adoc
@@ -37,7 +37,7 @@ vertx-http:hostname[:port][/resourceUri][?options]
== Options
// component options: START
-The Vert.x HTTP Client component supports 17 options, which are listed below.
+The Vert.x HTTP Client component supports 18 options, which are listed below.
@@ -45,6 +45,7 @@ The Vert.x HTTP Client component supports 17 options, which
are listed below.
|===
| Name | Description | Default | Type
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
+| *responsePayloadAsByteArray* (producer) | Whether the response body should
be byte or as io.vertx.core.buffer.Buffer | true | boolean
| *allowJavaSerializedObject* (advanced) | Whether to allow java serialization
when a request has the Content-Type application/x-java-serialized-object This
is disabled by default. If you enable this, be aware that Java will deserialize
the incoming data from the request. This can be a potential security risk. |
false | boolean
| *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used
for automatic autowiring options (the option must be marked as autowired) by
looking up in the registry to find if there is a single instance of matching
type, which then gets configured on the component. This can be used for
automatic configuring JDBC data sources, JMS connection factories, AWS Clients,
etc. | true | boolean
| *vertx* (advanced) | To use an existing vertx instead of creating a new
instance | | Vertx
@@ -83,7 +84,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (22 parameters):
+=== Query Parameters (23 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -95,6 +96,7 @@ with the following path and query parameters:
| *httpMethod* (producer) | The HTTP method to use. The HttpMethod header
cannot override this option if set. There are 10 enums and the value can be one
of: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PATCH, OTHER | |
HttpMethod
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
| *okStatusCodeRange* (producer) | The status codes which are considered a
success response. The values are inclusive. Multiple ranges can be defined,
separated by comma, e.g. 200-204,209,301-304. Each range must be a single
number or from-to with the dash included | 200-299 | String
+| *responsePayloadAsByteArray* (producer) | Whether the response body should
be byte or as io.vertx.core.buffer.Buffer | true | boolean
| *sessionManagement* (producer) | Enables session management via
WebClientSession. By default the client is configured to use an in-memory
CookieStore. The cookieStore option can be used to override this | false |
boolean
| *throwExceptionOnFailure* (producer) | Disable throwing
HttpOperationFailedException in case of failed responses from the remote server
| true | boolean
| *timeout* (producer) | The amount of time in milliseconds after which if the
request does not return any data within the timeout period a TimeoutException
fails the request. Setting zero or a negative value disables the timeout. | -1
| long
diff --git
a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
index 959486e..afc76a4 100644
---
a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
+++
b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
@@ -214,7 +214,11 @@ public class DefaultVertxHttpBinding implements
VertxHttpBinding {
}
}
} else {
- return responseBody.getBytes();
+ if
(endpoint.getConfiguration().isResponsePayloadAsByteArray()) {
+ return responseBody.getBytes();
+ } else {
+ return responseBody;
+ }
}
}
return null;
diff --git
a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxBufferConverter.java
b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxBufferConverter.java
index 95d8517..e3e9413 100644
---
a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxBufferConverter.java
+++
b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxBufferConverter.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.vertx.http;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -79,4 +80,9 @@ public final class VertxBufferConverter {
public static byte[] toBytes(Buffer buffer) {
return buffer.getBytes();
}
+
+ @Converter
+ public static InputStream toInputStream(Buffer buffer) {
+ return new ByteArrayInputStream(buffer.getBytes());
+ }
}
diff --git
a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpComponent.java
b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpComponent.java
index 67d0867..526beb9 100644
---
a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpComponent.java
+++
b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpComponent.java
@@ -77,10 +77,13 @@ public class VertxHttpComponent extends
HeaderFilterStrategyComponent
private boolean useGlobalSslContextParameters;
@Metadata(label = "advanced")
private boolean allowJavaSerializedObject;
+ @Metadata(label = "producer", defaultValue = "true")
+ protected boolean responsePayloadAsByteArray = true;
@Override
protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
VertxHttpConfiguration configuration = new VertxHttpConfiguration();
+
configuration.setResponsePayloadAsByteArray(responsePayloadAsByteArray);
URI uriHttpUriAddress = new
URI(UnsafeUriCharactersEncoder.encodeHttpURI(remaining));
@@ -296,6 +299,17 @@ public class VertxHttpComponent extends
HeaderFilterStrategyComponent
this.allowJavaSerializedObject = allowJavaSerializedObject;
}
+ public boolean isResponsePayloadAsByteArray() {
+ return responsePayloadAsByteArray;
+ }
+
+ /**
+ * Whether the response body should be byte[] or as
io.vertx.core.buffer.Buffer
+ */
+ public void setResponsePayloadAsByteArray(boolean
responsePayloadAsByteArray) {
+ this.responsePayloadAsByteArray = responsePayloadAsByteArray;
+ }
+
/**
* The proxy server host address
*/
@@ -394,5 +408,4 @@ public class VertxHttpComponent extends
HeaderFilterStrategyComponent
public void setSslContextParameters(SSLContextParameters
sslContextParameters) {
this.sslContextParameters = sslContextParameters;
}
-
}
diff --git
a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpConfiguration.java
b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpConfiguration.java
index 9258b1d..a3e14fe 100644
---
a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpConfiguration.java
+++
b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpConfiguration.java
@@ -58,6 +58,8 @@ public class VertxHttpConfiguration {
private CookieStore cookieStore;
@UriParam(label = "producer", defaultValue = "false")
private boolean useCompression;
+ @UriParam(label = "producer", defaultValue = "true")
+ protected boolean responsePayloadAsByteArray = true;
@UriParam(label = "security")
private String basicAuthUsername;
@UriParam(label = "security")
@@ -225,6 +227,17 @@ public class VertxHttpConfiguration {
return useCompression;
}
+ public boolean isResponsePayloadAsByteArray() {
+ return responsePayloadAsByteArray;
+ }
+
+ /**
+ * Whether the response body should be byte[] or as
io.vertx.core.buffer.Buffer
+ */
+ public void setResponsePayloadAsByteArray(boolean
responsePayloadAsByteArray) {
+ this.responsePayloadAsByteArray = responsePayloadAsByteArray;
+ }
+
/**
* The user name to use for basic authentication
*/
diff --git
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/VertxHttpComponentBuilderFactory.java
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/VertxHttpComponentBuilderFactory.java
index fcee245..c71ccdf 100644
---
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/VertxHttpComponentBuilderFactory.java
+++
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/VertxHttpComponentBuilderFactory.java
@@ -75,6 +75,23 @@ public interface VertxHttpComponentBuilderFactory {
return this;
}
/**
+ * Whether the response body should be byte or as
+ * io.vertx.core.buffer.Buffer.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: true
+ * Group: producer
+ *
+ * @param responsePayloadAsByteArray the value to set
+ * @return the dsl builder
+ */
+ default VertxHttpComponentBuilder responsePayloadAsByteArray(
+ boolean responsePayloadAsByteArray) {
+ doSetProperty("responsePayloadAsByteArray",
responsePayloadAsByteArray);
+ return this;
+ }
+ /**
* Whether to allow java serialization when a request has the
* Content-Type application/x-java-serialized-object This is disabled
by
* default. If you enable this, be aware that Java will deserialize the
@@ -349,6 +366,7 @@ public interface VertxHttpComponentBuilderFactory {
Object value) {
switch (name) {
case "lazyStartProducer": ((VertxHttpComponent)
component).setLazyStartProducer((boolean) value); return true;
+ case "responsePayloadAsByteArray": ((VertxHttpComponent)
component).setResponsePayloadAsByteArray((boolean) value); return true;
case "allowJavaSerializedObject": ((VertxHttpComponent)
component).setAllowJavaSerializedObject((boolean) value); return true;
case "autowiredEnabled": ((VertxHttpComponent)
component).setAutowiredEnabled((boolean) value); return true;
case "vertx": ((VertxHttpComponent)
component).setVertx((io.vertx.core.Vertx) value); return true;
diff --git
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/VertxHttpEndpointBuilderFactory.java
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/VertxHttpEndpointBuilderFactory.java
index c61ab73..fb126c5 100644
---
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/VertxHttpEndpointBuilderFactory.java
+++
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/VertxHttpEndpointBuilderFactory.java
@@ -242,6 +242,41 @@ public interface VertxHttpEndpointBuilderFactory {
return this;
}
/**
+ * Whether the response body should be byte or as
+ * io.vertx.core.buffer.Buffer.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: true
+ * Group: producer
+ *
+ * @param responsePayloadAsByteArray the value to set
+ * @return the dsl builder
+ */
+ default VertxHttpEndpointBuilder responsePayloadAsByteArray(
+ boolean responsePayloadAsByteArray) {
+ doSetProperty("responsePayloadAsByteArray",
responsePayloadAsByteArray);
+ return this;
+ }
+ /**
+ * Whether the response body should be byte or as
+ * io.vertx.core.buffer.Buffer.
+ *
+ * The option will be converted to a <code>boolean</code>
+ * type.
+ *
+ * Default: true
+ * Group: producer
+ *
+ * @param responsePayloadAsByteArray the value to set
+ * @return the dsl builder
+ */
+ default VertxHttpEndpointBuilder responsePayloadAsByteArray(
+ String responsePayloadAsByteArray) {
+ doSetProperty("responsePayloadAsByteArray",
responsePayloadAsByteArray);
+ return this;
+ }
+ /**
* Enables session management via WebClientSession. By default the
* client is configured to use an in-memory CookieStore. The
cookieStore
* option can be used to override this.
diff --git a/docs/components/modules/ROOT/pages/vertx-http-component.adoc
b/docs/components/modules/ROOT/pages/vertx-http-component.adoc
index 36ea393..f64f223 100644
--- a/docs/components/modules/ROOT/pages/vertx-http-component.adoc
+++ b/docs/components/modules/ROOT/pages/vertx-http-component.adoc
@@ -39,7 +39,7 @@ vertx-http:hostname[:port][/resourceUri][?options]
== Options
// component options: START
-The Vert.x HTTP Client component supports 17 options, which are listed below.
+The Vert.x HTTP Client component supports 18 options, which are listed below.
@@ -47,6 +47,7 @@ The Vert.x HTTP Client component supports 17 options, which
are listed below.
|===
| Name | Description | Default | Type
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
+| *responsePayloadAsByteArray* (producer) | Whether the response body should
be byte or as io.vertx.core.buffer.Buffer | true | boolean
| *allowJavaSerializedObject* (advanced) | Whether to allow java serialization
when a request has the Content-Type application/x-java-serialized-object This
is disabled by default. If you enable this, be aware that Java will deserialize
the incoming data from the request. This can be a potential security risk. |
false | boolean
| *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used
for automatic autowiring options (the option must be marked as autowired) by
looking up in the registry to find if there is a single instance of matching
type, which then gets configured on the component. This can be used for
automatic configuring JDBC data sources, JMS connection factories, AWS Clients,
etc. | true | boolean
| *vertx* (advanced) | To use an existing vertx instead of creating a new
instance | | Vertx
@@ -85,7 +86,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (22 parameters):
+=== Query Parameters (23 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -97,6 +98,7 @@ with the following path and query parameters:
| *httpMethod* (producer) | The HTTP method to use. The HttpMethod header
cannot override this option if set. There are 10 enums and the value can be one
of: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PATCH, OTHER | |
HttpMethod
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
| *okStatusCodeRange* (producer) | The status codes which are considered a
success response. The values are inclusive. Multiple ranges can be defined,
separated by comma, e.g. 200-204,209,301-304. Each range must be a single
number or from-to with the dash included | 200-299 | String
+| *responsePayloadAsByteArray* (producer) | Whether the response body should
be byte or as io.vertx.core.buffer.Buffer | true | boolean
| *sessionManagement* (producer) | Enables session management via
WebClientSession. By default the client is configured to use an in-memory
CookieStore. The cookieStore option can be used to override this | false |
boolean
| *throwExceptionOnFailure* (producer) | Disable throwing
HttpOperationFailedException in case of failed responses from the remote server
| true | boolean
| *timeout* (producer) | The amount of time in milliseconds after which if the
request does not return any data within the timeout period a TimeoutException
fails the request. Setting zero or a negative value disables the timeout. | -1
| long