HTTP Client usage

You can use the HTTP Client to access HTTP resources across the network, using either HTTP/1.1 or HTTP/2, sending a request and accepting responses asynchronously, in a non-blocking manner. It uses Reactive Streams to work asynchronously with requests and responses.

It can also be used to send requests and receive responses synchronously.

The HTTP Client API consists of three main classes or interfaces:

  • The HttpClient class 
  • The HttpRequest class 
  • The HttpResponse interface 

The HttpClient class is used to send a request and retrieve the corresponding responses; HttpRequest encapsulates the details of the requested resource, including the request URI. The HttpResponse class encapsulates the response from the server.

In Java 11, the standardized HTTP Client is defined in the java.net.http module and package.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.188.244