Package com.luciad.net.http
Interface IHttpClient
- All Known Implementing Classes:
HttpClient
public interface IHttpClient
Interface for sending HTTP requests.
Implementations of this interface must be thread-safe.
See also the related guide on How to customize HTTP requests when loading data.
- Since:
- 2023.0
-
Method Summary
Modifier and TypeMethodDescriptionsend
(HttpRequest request, CancellationToken token) Returns theHTTP response
for the givenHTTP request
.
-
Method Details
-
send
@NotNull HttpResponse send(@NotNull HttpRequest request, @NotNull CancellationToken token) throws IOException Returns theHTTP response
for the givenHTTP request
.This method is synchronous and blocks until the request has been sent and the response has been received.
The request process can be canceled by the means of the
cancellation token
. It is up to the implementer to verify that the cancellation token state is set totrue
during the operation. When set totrue
this indicates that a HTTP response is no longer needed. The return value then can be anErrorInfo
object with the error codeinvalid reference
Canceled
- Parameters:
request
- HTTP request.token
- Cancellation token.- Returns:
- the HTTP response.
- Throws:
IOException
- when loading the data fails.
-