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.git
The following commit(s) were added to refs/heads/main by this push: new 4e048794fe3 CAMEL-21712: Add rfc8707 support to http component. Thread safety. And http producer should create http client in doInit and not constructor. 4e048794fe3 is described below commit 4e048794fe3d0e941ffc7e41e08a2644fd8a0857 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Mar 1 12:36:39 2025 +0100 CAMEL-21712: Add rfc8707 support to http component. Thread safety. And http producer should create http client in doInit and not constructor. --- .../src/main/java/org/apache/camel/component/http/HttpProducer.java | 3 ++- .../org/apache/camel/component/http/OAuth2ClientConfigurer.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java index 32fe2d15727..e5c93af69f4 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java @@ -102,7 +102,6 @@ public class HttpProducer extends DefaultProducer implements LineNumberAware { public HttpProducer(HttpEndpoint endpoint) { super(endpoint); - this.httpClient = endpoint.getHttpClient(); this.httpContext = endpoint.getHttpContext(); this.throwException = endpoint.isThrowExceptionOnFailure(); this.transferException = endpoint.isTransferException(); @@ -112,6 +111,8 @@ public class HttpProducer extends DefaultProducer implements LineNumberAware { protected void doInit() throws Exception { super.doInit(); + this.httpClient = getEndpoint().getHttpClient(); + String range = getEndpoint().getOkStatusCodeRange(); parseStatusRange(range); diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/OAuth2ClientConfigurer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/OAuth2ClientConfigurer.java index 3e1291f1903..2c582f411e6 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/OAuth2ClientConfigurer.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/OAuth2ClientConfigurer.java @@ -20,8 +20,8 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.time.Instant; -import java.util.HashMap; -import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicReference; import org.apache.camel.util.json.DeserializationException; @@ -48,7 +48,7 @@ public class OAuth2ClientConfigurer implements HttpClientConfigurer { private final boolean cacheTokens; private final Long cachedTokensDefaultExpirySeconds; private final Long cachedTokensExpirationMarginSeconds; - private final static Map<OAuth2URIAndCredentials, TokenCache> tokenCache = new HashMap<>(); + private final static ConcurrentMap<OAuth2URIAndCredentials, TokenCache> tokenCache = new ConcurrentHashMap<>(); private final String resourceIndicator; public OAuth2ClientConfigurer(String clientId, String clientSecret, String tokenEndpoint, String resourceIndicator,