A Jersey connector using java.net.http.HttpClient
and supporting HTTP/1.1 and HTTP/2.0 with the same client. The protocol is selected based on the server capabilities.
To build a JAX-RS client, you can use the following.
var client = ClientBuilder.newClient(new ClientConfig().connectorProvider(HttpClientConnector::new))
If you want to customise the Java HTTP client you are using, you can use the following.
var httpClient = HttpClient.newHttpClient();
var client = ClientBuilder.newClient(
new ClientConfig()
.connectorProvider(
(jaxRsClient, config) -> new HttpClientConnector(httpClient)))
Inspired from Stackoverflow question without answer Support HTTP/1.1 and HTTP/2 with a JAX-RS client.
Version 0.3 is compatible with Jersey 2 while version 1.1 uses Jersey 3.