HTTP/2.0 support

We used to connect servers using HttpURLConnection, which works in a single request/response cycle, and this eventually increases web page loading time and latency.

Moreover, the difference between HTTP/1.1 of older JDK and HTTP/2 of JAVA 9 is that data is framed when transporting between clients and servers. HTTP/2 uses the HttpClient API to push data by using the server push feature, with this it allows us to prioritize and send required data for loading the web page first. The following example shows HTTP interaction for the GET method:

//Get the HttpClient objectHttpClient client = HttpClient.newHttpClient(); // GET Method callHttpResponse<String> getResponse = client.send(    HttpRequest .newBuilder(new URI("http://www.xyz.com/") ...

Get Java 9 Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.