An HTTP response.
An HttpResponse is not created directly, but rather returned as
a result of sending an HttpRequest. An HttpResponse is
made available when the response status code and headers have been received,
and typically after the response body has also been completely received.
Whether or not the HttpResponse is made available before the response
body has been completely received depends on the BodyHandler provided when sending the HttpRequest.
This class provides methods for accessing the response status code,
headers, the response body, and the HttpRequest corresponding
to this response.
The following is an example of retrieving a response as a String:
HttpResponse<String> response = client
.send(request, BodyHandlers.ofString());
The class BodyHandlers provides implementations
of many common response handlers. Alternatively, a custom BodyHandler
implementation can be used.