Skip to content

Commit 5bdf411

Browse files
authored
Support Helidon3 and Helidon4 (precedence) by helidon connector. (#5958)
Signed-off-by: jansupol <jan.supol@oracle.com>
1 parent b37c986 commit 5bdf411

File tree

17 files changed

+882
-29
lines changed

17 files changed

+882
-29
lines changed

connectors/helidon-connector/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<profile>
9292
<id>HelidonExclude</id>
9393
<activation>
94-
<jdk>[1.8,17)</jdk>
94+
<jdk>[1.8,21)</jdk>
9595
</activation>
9696
<build>
9797
<directory>${java8.build.outputDirectory}</directory>
@@ -129,9 +129,11 @@
129129
<profile>
130130
<id>HelidonInclude</id>
131131
<activation>
132-
<jdk>[17,)</jdk>
132+
<jdk>[21,)</jdk>
133133
</activation>
134134
<build>
135+
<!-- 17 is correct, the module works with Helidon 3 supporting JDK 17, too -->
136+
<!-- The build is against Helidon 4, which requires JDK 21 for the build, though -->
135137
<directory>${java17.build.outputDirectory}</directory>
136138
<plugins>
137139
<plugin>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
16+
17+
package org.glassfish.jersey.helidon.connector;
18+
19+
import jakarta.ws.rs.client.Client;
20+
import jakarta.ws.rs.core.Configuration;
21+
import org.glassfish.jersey.Beta;
22+
import org.glassfish.jersey.client.spi.Connector;
23+
24+
@Beta
25+
class Helidon3ConnectorProvider extends io.helidon.jersey.connector.HelidonConnectorProvider {
26+
@Override
27+
public Connector getConnector(Client client, Configuration runtimeConfig) {
28+
return super.getConnector(client, runtimeConfig);
29+
}
30+
}

connectors/helidon-connector/src/main/java17/org/glassfish/jersey/helidon/connector/HelidonClientProperties.java

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2025 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -13,13 +13,16 @@
1313
*
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
*/
16+
1617
package org.glassfish.jersey.helidon.connector;
1718

18-
import io.helidon.jersey.connector.HelidonProperties;
19+
import io.helidon.common.tls.Tls;
20+
import io.helidon.config.Config;
21+
import io.helidon.webclient.api.WebClient;
1922
import org.glassfish.jersey.internal.util.PropertiesClass;
2023

21-
import io.helidon.config.Config;
22-
import io.helidon.webclient.WebClient;
24+
import java.util.List;
25+
import java.util.Map;
2326

2427
/**
2528
* Configuration options specific to the Client API that utilizes {@code HelidonConnectorProvider}.
@@ -28,8 +31,60 @@
2831
@PropertiesClass
2932
public final class HelidonClientProperties {
3033

34+
private HelidonClientProperties() {
35+
}
36+
37+
/**
38+
* Property name to set a {@link Config} instance to by used by underlying {@link WebClient}.
39+
* This property is settable on {@link jakarta.ws.rs.core.Configurable#property(String, Object)}.
40+
*
41+
* @see io.helidon.webclient.api.WebClientConfig.Builder#config(io.helidon.common.config.Config)
42+
*/
43+
public static final String CONFIG = "jersey.connector.helidon.config";
44+
45+
/**
46+
* Property name to set a {@link Tls} instance to be used by underlying {@link WebClient}.
47+
* This property is settable on {@link jakarta.ws.rs.core.Configurable#property(String, Object)}.
48+
*
49+
* @see io.helidon.webclient.api.WebClientConfig.Builder#tls(Tls)
50+
*/
51+
public static final String TLS = "jersey.connector.helidon.tls";
52+
53+
/**
54+
* Property name to set a {@code List<? extends ProtocolConfig>} instance with a list of
55+
* protocol configs to be used by underlying {@link WebClient}.
56+
* This property is settable on {@link jakarta.ws.rs.core.Configurable#property(String, Object)}.
57+
*
58+
* @see io.helidon.webclient.api.WebClientConfig.Builder#protocolConfigs(List)
59+
*/
60+
public static final String PROTOCOL_CONFIGS = "jersey.connector.helidon.protocolConfigs";
61+
62+
/**
63+
* Property name to set a {@code Map<String, String>} instance with a list of
64+
* default headers to be used by underlying {@link WebClient}.
65+
* This property is settable on {@link jakarta.ws.rs.core.Configurable#property(String, Object)}.
66+
*
67+
* @see io.helidon.webclient.api.WebClientConfig.Builder#defaultHeadersMap(Map)
68+
*/
69+
public static final String DEFAULT_HEADERS = "jersey.connector.helidon.defaultHeaders";
70+
71+
/**
72+
* Property name to set a protocol ID for each request. You can use this property
73+
* to request an HTTP/2 upgrade from HTTP/1.1 by setting its value to {@code "h2"}.
74+
* When using TLS, Helidon uses negotiation via the ALPN extension instead of this
75+
* property.
76+
*
77+
* @see io.helidon.webclient.api.HttpClientRequest#protocolId(String)
78+
*/
79+
public static final String PROTOCOL_ID = "jersey.connector.helidon.protocolId";
80+
3181
/**
32-
* A Helidon {@link Config} instance that is passed to {@link WebClient.Builder#config(Config)} if available
82+
* Property name to enable or disable connection caching in the underlying {@link WebClient}.
83+
* The default for the Helidon connector is {@code false}, or no sharing (which is the
84+
* opposite of {@link WebClient}). Set this property to {@code true} to enable connection
85+
* caching.
86+
*
87+
* @see io.helidon.webclient.api.WebClientConfig.Builder#shareConnectionCache(boolean)
3388
*/
34-
public static final String CONFIG = HelidonProperties.CONFIG;
89+
public static final String SHARE_CONNECTION_CACHE = "jersey.connector.helidon.shareConnectionCache";
3590
}

0 commit comments

Comments
 (0)