public class OkHttpClient extends java.lang.Object implements HttpClient
| Modifier and Type | Field and Description |
|---|---|
protected okhttp3.OkHttpClient |
httpClient |
| Constructor and Description |
|---|
OkHttpClient()
Initializes the OhHttp# httpClient.
|
OkHttpClient(okhttp3.OkHttpClient httpClient)
Initializes the OhHttp# httpClient.
|
OkHttpClient(java.util.concurrent.TimeUnit timeUnit,
long timeout)
Initializes the OhHttp# httpClient.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletableFuture<java.lang.String> |
get(java.lang.String url)
Performs a GET request with the given url using the httpClient from
okhttp3.
|
protected static java.util.concurrent.CompletableFuture<java.lang.String> |
getStringCompletableFuture(java.lang.String url,
okhttp3.OkHttpClient httpClient) |
public OkHttpClient()
Note: Default timeout is 1 second
public OkHttpClient(java.util.concurrent.TimeUnit timeUnit,
long timeout)
timeUnit - Specify the unit of the timeout value.timeout - Specify a request timeout for the httpClient.public OkHttpClient(okhttp3.OkHttpClient httpClient)
httpClient - An instance of okhttp3.OkHttpClient for Ascend to use.public java.util.concurrent.CompletableFuture<java.lang.String> get(java.lang.String url)
get in interface HttpClienturl - a valid url representing a call to the Participant API.protected static java.util.concurrent.CompletableFuture<java.lang.String> getStringCompletableFuture(java.lang.String url,
okhttp3.OkHttpClient httpClient)