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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.5