Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Creating an HttpClient that does HTTP/2 only over ALPN

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?




Back to the top