February 2019
Intermediate to advanced
446 pages
10h 55m
English
HttpClient was officially introduced with Java 11. It was first introduced in Java 9 as an incubator. You could say it is a new version of java.net.HttpUrlConnection.
It offers many new features:
It works very well in asynchronous mode and with streams. However, here, we'll only cover the synchronous calls to align with other REST clients.
First, we'll add a provider class that will build the HttpClient and provide methods to build and send HTTP requests, as shown in the following example:
public class RestClient { HttpClient httpClient ...Read now
Unlock full access