Jetty’s HttpClient is a fast, scalable, asynchronous implementation of a HTTP client.
But it is even more.
Jetty’s HttpClient provides a high level API with HTTP semantic. This means that your applications will be able to perform HTTP requests and receive HTTP responses with a rich API. For example, you can use HttpClient to perform REST requests from the client or from within your web application to third party REST services.
Jetty’s HttpClient provides also pluggable transports. This means that the concept of a HTTP request and response is translated by HttpClient to SPDY, FastCGI, HTTP/1.1 or other protocols and transported over the network in SPDY, FastCGI and HTTP/1.1 formats, in a way that is totally transparent for the application, which will only see a high level HTTP request and a response.
Applications will get improved performance when using more performant transports.
The new addition in Jetty 9.3 is a HTTP/2 transport for HttpClient, replacing the SPDY transport.
This means that now HttpClient can talk to a regular HTTP/1.1 server, or to a FastCGI server that serves PHP pages, or to a HTTP/2 server transparently.
The HTTP/2 specification is in its final phases, so the HTTP/2 protocol is now stable and well supported: Firefox, Chrome, Internet Explorer 11 already supports HTTP/2, and as the time passes they will be enabling HTTP/2 by default (some already have).
And it’s not only browsers and servers such as Google, Twitter, etc.: also tools and libraries such as curl and nghttp2, among many others.
The Jetty project implemented HTTP/2 since June 2014 and this very website has been served using Jetty’s HTTP/2 implementation for now over 6 months, helping to finalize the interoperability among different implementations.
You are probably already reading this blog entry served via HTTP/2, if you are using a recent browser.
Contact us if you are interested in deploying HTTP/2 in your infrastructure and benefit from the performance improvements that it brings.
2 thoughts on “HTTP/2 Support for HttpClient”
DEMO: https://github.com/eclipse/jetty.project/blob/jetty-http2/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/Client.java has wrong: java.lang.ClassNotFoundException: org.eclipse.jetty.alpn.ALPN$ClientProvider
You must have the ALPN classes in your bootclasspath as explained here: https://www.eclipse.org/jetty/documentation/current/alpn-chapter.html.