This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new 281496a41f7 CAMEL-22256: camel-http - Configuring tineout options
should be tooling friendly
281496a41f7 is described below
commit 281496a41f7fc258968c636ff6307fd820656bd0
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Jul 21 21:44:07 2025 +0200
CAMEL-22256: camel-http - Configuring tineout options should be tooling
friendly
---
.../camel/springboot/catalog/components/http.json | 8 ++--
.../camel/springboot/catalog/components/https.json | 8 ++--
.../camel-http-starter/src/main/docs/http.json | 25 ++++++-----
.../springboot/HttpComponentConfiguration.java | 51 ++++++++++------------
.../http/springboot/HttpComponentConverter.java | 2 -
.../HttpComponentTimeoutConverterTest.java | 5 +--
6 files changed, 48 insertions(+), 51 deletions(-)
diff --git
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/http.json
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/http.json
index 8a04f50c45e..95a322a912f 100644
---
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/http.json
+++
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/http.json
@@ -68,10 +68,10 @@
"sslContextParameters": { "index": 38, "kind": "property", "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. Important: Only one instance of
org.apache.camel.support.jsse.SSLContextParameters is supported per
HttpComponent. If y [...]
"useGlobalSslContextParameters": { "index": 39, "kind": "property",
"displayName": "Use Global Ssl Context Parameters", "group": "security",
"label": "security", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Enable usage of global SSL context
parameters." },
"x509HostnameVerifier": { "index": 40, "kind": "property", "displayName":
"X509 Hostname Verifier", "group": "security", "label": "security", "required":
false, "type": "object", "javaType": "javax.net.ssl.HostnameVerifier",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom X509HostnameVerifier such as DefaultHostnameVerifier or
NoopHostnameVerifier." },
- "connectionRequestTimeout": { "index": 41, "kind": "property",
"displayName": "Connection Request Timeout", "group": "timeout", "label":
"timeout", "required": false, "type": "object", "javaType":
"org.apache.hc.core5.util.Timeout", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "3 minutes", "description": "Returns the
connection lease request timeout used when requesting a connection from the
connection manager. A timeout value of zero is interpreted as a [...]
- "connectTimeout": { "index": 42, "kind": "property", "displayName":
"Connect Timeout", "group": "timeout", "label": "timeout", "required": false,
"type": "object", "javaType": "org.apache.hc.core5.util.Timeout", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": "3 minutes",
"description": "Determines the timeout until a new connection is fully
established. A timeout value of zero is interpreted as an infinite timeout." },
- "responseTimeout": { "index": 43, "kind": "property", "displayName":
"Response Timeout", "group": "timeout", "label": "timeout", "required": false,
"type": "object", "javaType": "org.apache.hc.core5.util.Timeout", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": "0", "description":
"Determines the timeout until arrival of a response from the opposite endpoint.
A timeout value of zero is interpreted as an infinite timeout. Please note that
response timeout may [...]
- "soTimeout": { "index": 44, "kind": "property", "displayName": "So
Timeout", "group": "timeout", "label": "timeout", "required": false, "type":
"object", "javaType": "org.apache.hc.core5.util.Timeout", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "3 minutes",
"description": "Determines the default socket timeout value for blocking I\/O
operations." }
+ "connectionRequestTimeout": { "index": 41, "kind": "property",
"displayName": "Connection Request Timeout", "group": "timeout", "label":
"timeout", "required": false, "type": "integer", "javaType": "long",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
180000, "description": "Returns the connection lease request timeout (in
millis) used when requesting a connection from the connection manager. A
timeout value of zero is interpreted as a disabled timeout." },
+ "connectTimeout": { "index": 42, "kind": "property", "displayName":
"Connect Timeout", "group": "timeout", "label": "timeout", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 180000, "description": "Determines the timeout
(in millis) until a new connection is fully established. A timeout value of
zero is interpreted as an infinite timeout." },
+ "responseTimeout": { "index": 43, "kind": "property", "displayName":
"Response Timeout", "group": "timeout", "label": "timeout", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "description": "Determines the timeout (in millis) until
arrival of a response from the opposite endpoint. A timeout value of zero is
interpreted as an infinite timeout. Please note that response timeout may be
unsupported by HTTP transports w [...]
+ "soTimeout": { "index": 44, "kind": "property", "displayName": "So
Timeout", "group": "timeout", "label": "timeout", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 180000, "description": "Determines the default
socket timeout (in millis) value for blocking I\/O operations." }
},
"headers": {
"Content-Encoding": { "index": 0, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The HTTP content encoding. Is set on both the IN and OUT
message to provide a content encoding, such as gzip.", "constantName":
"org.apache.camel.component.http.HttpConstants#CONTENT_ENCODING" },
diff --git
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/https.json
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/https.json
index 1b4b6dd1514..41d3ce4097c 100644
---
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/https.json
+++
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/https.json
@@ -68,10 +68,10 @@
"sslContextParameters": { "index": 38, "kind": "property", "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. Important: Only one instance of
org.apache.camel.support.jsse.SSLContextParameters is supported per
HttpComponent. If y [...]
"useGlobalSslContextParameters": { "index": 39, "kind": "property",
"displayName": "Use Global Ssl Context Parameters", "group": "security",
"label": "security", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Enable usage of global SSL context
parameters." },
"x509HostnameVerifier": { "index": 40, "kind": "property", "displayName":
"X509 Hostname Verifier", "group": "security", "label": "security", "required":
false, "type": "object", "javaType": "javax.net.ssl.HostnameVerifier",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom X509HostnameVerifier such as DefaultHostnameVerifier or
NoopHostnameVerifier." },
- "connectionRequestTimeout": { "index": 41, "kind": "property",
"displayName": "Connection Request Timeout", "group": "timeout", "label":
"timeout", "required": false, "type": "object", "javaType":
"org.apache.hc.core5.util.Timeout", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "3 minutes", "description": "Returns the
connection lease request timeout used when requesting a connection from the
connection manager. A timeout value of zero is interpreted as a [...]
- "connectTimeout": { "index": 42, "kind": "property", "displayName":
"Connect Timeout", "group": "timeout", "label": "timeout", "required": false,
"type": "object", "javaType": "org.apache.hc.core5.util.Timeout", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": "3 minutes",
"description": "Determines the timeout until a new connection is fully
established. A timeout value of zero is interpreted as an infinite timeout." },
- "responseTimeout": { "index": 43, "kind": "property", "displayName":
"Response Timeout", "group": "timeout", "label": "timeout", "required": false,
"type": "object", "javaType": "org.apache.hc.core5.util.Timeout", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": "0", "description":
"Determines the timeout until arrival of a response from the opposite endpoint.
A timeout value of zero is interpreted as an infinite timeout. Please note that
response timeout may [...]
- "soTimeout": { "index": 44, "kind": "property", "displayName": "So
Timeout", "group": "timeout", "label": "timeout", "required": false, "type":
"object", "javaType": "org.apache.hc.core5.util.Timeout", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "3 minutes",
"description": "Determines the default socket timeout value for blocking I\/O
operations." }
+ "connectionRequestTimeout": { "index": 41, "kind": "property",
"displayName": "Connection Request Timeout", "group": "timeout", "label":
"timeout", "required": false, "type": "integer", "javaType": "long",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
180000, "description": "Returns the connection lease request timeout (in
millis) used when requesting a connection from the connection manager. A
timeout value of zero is interpreted as a disabled timeout." },
+ "connectTimeout": { "index": 42, "kind": "property", "displayName":
"Connect Timeout", "group": "timeout", "label": "timeout", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 180000, "description": "Determines the timeout
(in millis) until a new connection is fully established. A timeout value of
zero is interpreted as an infinite timeout." },
+ "responseTimeout": { "index": 43, "kind": "property", "displayName":
"Response Timeout", "group": "timeout", "label": "timeout", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "description": "Determines the timeout (in millis) until
arrival of a response from the opposite endpoint. A timeout value of zero is
interpreted as an infinite timeout. Please note that response timeout may be
unsupported by HTTP transports w [...]
+ "soTimeout": { "index": 44, "kind": "property", "displayName": "So
Timeout", "group": "timeout", "label": "timeout", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 180000, "description": "Determines the default
socket timeout (in millis) value for blocking I\/O operations." }
},
"headers": {
"Content-Encoding": { "index": 0, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The HTTP content encoding. Is set on both the IN and OUT
message to provide a content encoding, such as gzip.", "constantName":
"org.apache.camel.component.http.HttpConstants#CONTENT_ENCODING" },
diff --git a/components-starter/camel-http-starter/src/main/docs/http.json
b/components-starter/camel-http-starter/src/main/docs/http.json
index ab91ec02a75..912b41aa675 100644
--- a/components-starter/camel-http-starter/src/main/docs/http.json
+++ b/components-starter/camel-http-starter/src/main/docs/http.json
@@ -49,15 +49,17 @@
},
{
"name": "camel.component.http.connect-timeout",
- "type": "org.apache.hc.core5.util.Timeout",
- "description": "Determines the timeout until a new connection is fully
established. A timeout value of zero is interpreted as an infinite timeout. The
option is a org.apache.hc.core5.util.Timeout type.",
- "sourceType":
"org.apache.camel.component.http.springboot.HttpComponentConfiguration"
+ "type": "java.lang.Long",
+ "description": "Determines the timeout (in millis) until a new
connection is fully established. A timeout value of zero is interpreted as an
infinite timeout.",
+ "sourceType":
"org.apache.camel.component.http.springboot.HttpComponentConfiguration",
+ "defaultValue": 180000
},
{
"name": "camel.component.http.connection-request-timeout",
- "type": "org.apache.hc.core5.util.Timeout",
- "description": "Returns the connection lease request timeout used when
requesting a connection from the connection manager. A timeout value of zero is
interpreted as a disabled timeout. The option is a
org.apache.hc.core5.util.Timeout type.",
- "sourceType":
"org.apache.camel.component.http.springboot.HttpComponentConfiguration"
+ "type": "java.lang.Long",
+ "description": "Returns the connection lease request timeout (in millis)
used when requesting a connection from the connection manager. A timeout value
of zero is interpreted as a disabled timeout.",
+ "sourceType":
"org.apache.camel.component.http.springboot.HttpComponentConfiguration",
+ "defaultValue": 180000
},
{
"name": "camel.component.http.connection-state-disabled",
@@ -252,8 +254,8 @@
},
{
"name": "camel.component.http.response-timeout",
- "type": "org.apache.hc.core5.util.Timeout",
- "description": "Determines the timeout until arrival of a response from
the opposite endpoint. A timeout value of zero is interpreted as an infinite
timeout. Please note that response timeout may be unsupported by HTTP
transports with message multiplexing. The option is a
org.apache.hc.core5.util.Timeout type.",
+ "type": "java.lang.Long",
+ "description": "Determines the timeout (in millis) until arrival of a
response from the opposite endpoint. A timeout value of zero is interpreted as
an infinite timeout. Please note that response timeout may be unsupported by
HTTP transports with message multiplexing.",
"sourceType":
"org.apache.camel.component.http.springboot.HttpComponentConfiguration"
},
{
@@ -279,9 +281,10 @@
},
{
"name": "camel.component.http.so-timeout",
- "type": "org.apache.hc.core5.util.Timeout",
- "description": "Determines the default socket timeout value for blocking
I\/O operations. The option is a org.apache.hc.core5.util.Timeout type.",
- "sourceType":
"org.apache.camel.component.http.springboot.HttpComponentConfiguration"
+ "type": "java.lang.Long",
+ "description": "Determines the default socket timeout (in millis) value
for blocking I\/O operations.",
+ "sourceType":
"org.apache.camel.component.http.springboot.HttpComponentConfiguration",
+ "defaultValue": 180000
},
{
"name": "camel.component.http.ssl-context-parameters",
diff --git
a/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConfiguration.java
b/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConfiguration.java
index 46c12371e74..45cfb3e1f26 100644
---
a/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConfiguration.java
+++
b/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConfiguration.java
@@ -27,7 +27,6 @@ import org.apache.camel.support.jsse.SSLContextParameters;
import org.apache.hc.client5.http.cookie.CookieStore;
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.util.Timeout;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@@ -266,31 +265,29 @@ public class HttpComponentConfiguration
*/
private HostnameVerifier x509HostnameVerifier;
/**
- * Returns the connection lease request timeout used when requesting a
- * connection from the connection manager. A timeout value of zero is
- * interpreted as a disabled timeout. The option is a
- * org.apache.hc.core5.util.Timeout type.
+ * Returns the connection lease request timeout (in millis) used when
+ * requesting a connection from the connection manager. A timeout value of
+ * zero is interpreted as a disabled timeout.
*/
- private Timeout connectionRequestTimeout;
+ private Long connectionRequestTimeout = 180000L;
/**
- * Determines the timeout until a new connection is fully established. A
- * timeout value of zero is interpreted as an infinite timeout. The option
- * is a org.apache.hc.core5.util.Timeout type.
+ * Determines the timeout (in millis) until a new connection is fully
+ * established. A timeout value of zero is interpreted as an infinite
+ * timeout.
*/
- private Timeout connectTimeout;
+ private Long connectTimeout = 180000L;
/**
- * Determines the timeout until arrival of a response from the opposite
- * endpoint. A timeout value of zero is interpreted as an infinite timeout.
- * Please note that response timeout may be unsupported by HTTP transports
- * with message multiplexing. The option is a
- * org.apache.hc.core5.util.Timeout type.
+ * Determines the timeout (in millis) until arrival of a response from the
+ * opposite endpoint. A timeout value of zero is interpreted as an infinite
+ * timeout. Please note that response timeout may be unsupported by HTTP
+ * transports with message multiplexing.
*/
- private Timeout responseTimeout;
+ private Long responseTimeout;
/**
- * Determines the default socket timeout value for blocking I/O operations.
- * The option is a org.apache.hc.core5.util.Timeout type.
+ * Determines the default socket timeout (in millis) value for blocking I/O
+ * operations.
*/
- private Timeout soTimeout;
+ private Long soTimeout = 180000L;
public Boolean getLazyStartProducer() {
return lazyStartProducer;
@@ -627,35 +624,35 @@ public class HttpComponentConfiguration
this.x509HostnameVerifier = x509HostnameVerifier;
}
- public Timeout getConnectionRequestTimeout() {
+ public Long getConnectionRequestTimeout() {
return connectionRequestTimeout;
}
- public void setConnectionRequestTimeout(Timeout connectionRequestTimeout) {
+ public void setConnectionRequestTimeout(Long connectionRequestTimeout) {
this.connectionRequestTimeout = connectionRequestTimeout;
}
- public Timeout getConnectTimeout() {
+ public Long getConnectTimeout() {
return connectTimeout;
}
- public void setConnectTimeout(Timeout connectTimeout) {
+ public void setConnectTimeout(Long connectTimeout) {
this.connectTimeout = connectTimeout;
}
- public Timeout getResponseTimeout() {
+ public Long getResponseTimeout() {
return responseTimeout;
}
- public void setResponseTimeout(Timeout responseTimeout) {
+ public void setResponseTimeout(Long responseTimeout) {
this.responseTimeout = responseTimeout;
}
- public Timeout getSoTimeout() {
+ public Long getSoTimeout() {
return soTimeout;
}
- public void setSoTimeout(Timeout soTimeout) {
+ public void setSoTimeout(Long soTimeout) {
this.soTimeout = soTimeout;
}
}
\ No newline at end of file
diff --git
a/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConverter.java
b/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConverter.java
index b23b460de5d..e32c093ce0e 100644
---
a/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConverter.java
+++
b/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConverter.java
@@ -49,7 +49,6 @@ public class HttpComponentConverter implements
GenericConverter {
answer.add(new ConvertiblePair(String.class,
org.apache.camel.spi.HeaderFilterStrategy.class));
answer.add(new ConvertiblePair(String.class,
org.apache.camel.support.jsse.SSLContextParameters.class));
answer.add(new ConvertiblePair(String.class,
javax.net.ssl.HostnameVerifier.class));
- answer.add(new ConvertiblePair(String.class,
org.apache.hc.core5.util.Timeout.class));
return answer;
}
@@ -76,7 +75,6 @@ public class HttpComponentConverter implements
GenericConverter {
case "org.apache.camel.spi.HeaderFilterStrategy": return
applicationContext.getBean(ref,
org.apache.camel.spi.HeaderFilterStrategy.class);
case "org.apache.camel.support.jsse.SSLContextParameters": return
applicationContext.getBean(ref,
org.apache.camel.support.jsse.SSLContextParameters.class);
case "javax.net.ssl.HostnameVerifier": return
applicationContext.getBean(ref, javax.net.ssl.HostnameVerifier.class);
- case "org.apache.hc.core5.util.Timeout": return
applicationContext.getBean(ref, org.apache.hc.core5.util.Timeout.class);
}
return null;
}
diff --git
a/components-starter/camel-http-starter/src/test/java/org/apache/camel/component/http/springboot/HttpComponentTimeoutConverterTest.java
b/components-starter/camel-http-starter/src/test/java/org/apache/camel/component/http/springboot/HttpComponentTimeoutConverterTest.java
index 8dea7168c86..da9f149717e 100644
---
a/components-starter/camel-http-starter/src/test/java/org/apache/camel/component/http/springboot/HttpComponentTimeoutConverterTest.java
+++
b/components-starter/camel-http-starter/src/test/java/org/apache/camel/component/http/springboot/HttpComponentTimeoutConverterTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.camel.component.http.springboot;
import java.nio.charset.StandardCharsets;
@@ -71,7 +70,7 @@ class HttpComponentTimeoutConverterTest {
response.setCode(HttpStatus.SC_OK);
assertNotNull(currentContext);
response.setEntity(new StringEntity(
- String.valueOf(currentContext.getComponent("http",
HttpComponent.class).getSoTimeout().toSeconds()),
+ String.valueOf(currentContext.getComponent("http",
HttpComponent.class).getSoTimeout()),
StandardCharsets.US_ASCII));
}).create();
localServer.start();
@@ -99,7 +98,7 @@ class HttpComponentTimeoutConverterTest {
assertNull(exchange.getException());
Message out = exchange.getMessage();
assertNotNull(out);
- assertEquals("30", out.getBody(String.class));
+ assertEquals("30000", out.getBody(String.class));
}
// *************************************