https://github.com/nhenneaux/jersey-httpclient-connector
Jersey java.net.http.HttpClient Connector
https://github.com/nhenneaux/jersey-httpclient-connector
httpclient java jax-rs jax-rs-client jersey jersey-connector
Last synced: 6 months ago
JSON representation
Jersey java.net.http.HttpClient Connector
- Host: GitHub
- URL: https://github.com/nhenneaux/jersey-httpclient-connector
- Owner: nhenneaux
- License: lgpl-3.0
- Created: 2019-11-05T19:56:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-10-01T16:21:03.000Z (9 months ago)
- Last Synced: 2025-10-01T18:17:52.590Z (9 months ago)
- Topics: httpclient, java, jax-rs, jax-rs-client, jersey, jersey-connector
- Language: Java
- Homepage:
- Size: 410 KB
- Stars: 9
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Jersey Connector with `java.net.http.HttpClient`
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.
# Usage
To build a JAX-RS client, you can use the following.
```java
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.
```java
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](https://stackoverflow.com/questions/42348041/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.
[](https://github.com/nhenneaux/jersey-httpclient-connector/actions?query=workflow%3A%22Java+CI%22)
[](https://maven-badges.herokuapp.com/maven-central/com.github.nhenneaux.jersey.connector.httpclient/jersey-httpclient-connector)
[](https://sonarcloud.io/dashboard?id=nhenneaux_jersey-httpclient-connector)
[](https://sonarcloud.io/dashboard?id=nhenneaux_jersey-httpclient-connector)