Reputation: 4601
Following Jetty documentation of enabling HTTP/2,
I reached till the following step,
2015-06-17 14:16:12.549:INFO:oejs.ServerConnector:main: Started ServerConnector@6f32cd1e{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8080}
From the docs,
No major browser currently supports plain text HTTP/2, so the 8080 port will only be able to use HTTP/2 with specific clients (eg curl) that use the upgrade mechanism or assume HTTP/2.
The documentation mentions "specific clients", but what client I can use for overcoming this issue? I tried okHttp
and apache-httpclient
, okHttp
doesn't support the upgrade mechanism (AFAIK, Would be great if it is otherwise), and apache-httpClient
doesn't support h2
.
I basically need to make GET/POST request from my program to this endpoint(Obviously, using HTTP/2).
To put in a simple words, Please suggest any Java client which support non-encrypted http/2 (h2c)
Thanks!
Upvotes: 1
Views: 1859
Reputation: 27613
Apache HttpCore and HttpClient 5.0 support h2
as well as h2c
but presently do not support the http/1.1
to h2c
upgrade mechanism. I am not sure they ever will given it is unclear how useful this upgrade mechanism is in the first place.
For code examples please refer to
http://hc.apache.org/httpcomponents-client-5.0.x/examples-async.html
For HttpClient 4.5.x to HttpClient 5.0 upgrade guide please refer to:
https://ok2c.github.io/httpclient-migration-guide/
Upvotes: 1