I want to implement a JAX-RS client that support HTTP/1.1 and HTTP/2 for a JAX-RS client.
The idea is to use HTTP/2 if the server supports ALPN with HTTP/2 and uses HTTP/1.1 if the server does not provide any information.
I have read some articles about ALPN and it seems to be possible but I don't find anything supporting these protocol at the same time. I did not manage to plug these together.
I am currently using the Jetty HTTP/1.1 transport connector for Jersey and a custom implementation for HTTP/2 transport connector.
The first usable version of HTTP was created in 1997. Because it went through several stages of development, this first version of HTTP was called HTTP/1.1. This version is still in use on the web.
The JAX-RS client API is a Java based API used to access Web resources.
Java HTTP client provided with Java 11 is supporting HTTP/1.1 and HTTP/2 (see Introduction to the Java HTTP Client).
I have built a connector using it Jersey Connector using java.net.http.HttpClient
.
You can use it adding the following dependency.
<dependency>
<groupId>com.github.nhenneaux.jersey.connector.httpclient</groupId>
<artifactId>jersey-httpclient-connector</artifactId>
<version>0.2.2</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With