|
1 | | -*Java HTTP Client* was is used to send request HTTP resources over the network. |
| 1 | +*Java HTTP Client* is used to send request HTTP resources over the network. |
2 | 2 | It supports HTTP/1.1 and HTTP/2, both synchronous and asynchronous programming models, |
3 | 3 | handles request and response bodies as reactive-streams, and follows the familiar builder pattern. |
4 | 4 | It was added in Java 11. |
5 | 5 |
|
6 | 6 |
|
7 | | -* HttpClient: the main entry point of the API. This is the HTTP client that is used to send requests and receive responses. |
8 | | -It supports sending requests both synchronously and asynchronously by invoking its methods send and sendAsync, respectively. |
9 | | -To create an instance, a Builder is provided. Once created, the instance is immutable. |
10 | | -* HttpRequest: encapsulates an HTTP request, including the target URI, the method (GET, POST, etc), headers and other information. |
| 7 | +* HttpClient: It is the main entry point of the API. The client is used to send requests and receive responses. |
| 8 | +It supports sending requests both synchronously and asynchronously by calling its methods *send()* and *sendAsync()*, |
| 9 | +respectively. A *Builder* is provided to create an instance. Once the client is created, the instance is immutable. |
| 10 | +* HttpRequest: It encapsulates an HTTP request, including the target URI, the method (GET, POST, DELETE), headers and other information. |
11 | 11 | A request is constructed using a builder, is immutable once created, and can be sent multiple times. |
12 | | -* HttpRequest.BodyPublisher: if a request has a body (e.g. in POST requests), this is the entity responsible for publishing |
13 | | -the body content from a given source, e.g. from a string, a file, etc. |
14 | | -* HttpResponse: encapsulates an HTTP response, including headers and a message body, if any. This is what the client |
15 | | -receives after sending an HttpRequest. |
16 | | -* HttpResponse.BodyHandler: a functional interface that accepts some information about the response (status code and headers), |
17 | | -and returns a BodySubscriber, which itself handles consuming the response body. |
| 12 | +* HttpRequest.BodyPublisher: If a request has a body (e.g. in POST requests), this is the entity responsible for publishing |
| 13 | +the body content from a given source, for instance, from a string or a file. |
| 14 | +* HttpResponse: It encapsulates an HTTP response, including headers and a message body, if any. This is what the client |
| 15 | +receives after sending an *HttpRequest*. |
| 16 | +* HttpResponse.BodyHandler: It is a functional interface that accepts some information about the response (status code and headers), |
| 17 | +and returns a *BodySubscriber*, which itself handles consuming the response body. |
18 | 18 | * HttpResponse.BodySubscriber: subscribes for the response body and consumes its bytes into some other form (a string, a file, |
19 | 19 | or some other storage type). |
20 | 20 |
|
|
0 commit comments