public class OkHttpClientImpl extends Object implements HttpClient
HttpClient.Builder, HttpClient.Factory
Modifier and Type | Field and Description |
---|---|
static okhttp3.MediaType |
JSON |
static okhttp3.MediaType |
JSON_MERGE_PATCH |
static okhttp3.MediaType |
JSON_PATCH |
static okhttp3.MediaType |
STRATEGIC_MERGE_JSON_PATCH |
Constructor and Description |
---|
OkHttpClientImpl(okhttp3.OkHttpClient httpClient) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
okhttp3.OkHttpClient |
getOkHttpClient() |
HttpClient.Builder |
newBuilder()
Create a builder that starts with the same state as this client
|
HttpRequest.Builder |
newHttpRequestBuilder() |
WebSocket.Builder |
newWebSocketBuilder() |
<T> HttpResponse<T> |
send(HttpRequest request,
Class<T> type)
Send a request an wait for the result
|
<T> CompletableFuture<HttpResponse<T>> |
sendAsync(HttpRequest request,
Class<T> type)
Send an async request
|
public static final okhttp3.MediaType JSON
public static final okhttp3.MediaType JSON_PATCH
public static final okhttp3.MediaType STRATEGIC_MERGE_JSON_PATCH
public static final okhttp3.MediaType JSON_MERGE_PATCH
public void close()
close
in interface HttpClient
close
in interface AutoCloseable
public <T> HttpResponse<T> send(HttpRequest request, Class<T> type) throws IOException
HttpClient
send
in interface HttpClient
T
- return typetype
- one of InputStream, Reader, StringIOException
public HttpClient.Builder newBuilder()
HttpClient
newBuilder
in interface HttpClient
public <T> CompletableFuture<HttpResponse<T>> sendAsync(HttpRequest request, Class<T> type)
HttpClient
sendAsync
in interface HttpClient
T
- return typetype
- one of InputStream, Reader, Stringpublic WebSocket.Builder newWebSocketBuilder()
newWebSocketBuilder
in interface HttpClient
public okhttp3.OkHttpClient getOkHttpClient()
public HttpRequest.Builder newHttpRequestBuilder()
newHttpRequestBuilder
in interface HttpClient
Copyright © 2015–2022 Red Hat. All rights reserved.