Creating an HttpClient that does HTTP/2 only over ALPN

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Creating an HttpClient that does HTTP/2 only over ALPN

John Gardiner Myers
Using Jetty 9.4.12 embedded with Java 11.0.1 and the
jetty-alpn-java-client processor, I cannot figure out how to construct
an HttpClient which only uses HTTP/2 when talking to an HTTPS server
which supports h2 under ALPN, using HTTP/1.1 when talking to an HTTP
server or an HTTPS server which either does not support ALPN or does not
support h2.

An HttpClient constructed with a HttpClientTransportOverHTTP2 and a
SslContextFactory appears to use HTTP/2 in all situations.

Naturally, I'd like to configure any underlying HTTP2Client.

This seems like it would be a common use case, but I cannot find any
obvious documentation or example code. How does one do this?

jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit