Class StandardHttpClient<C extends HttpClient,F extends HttpClient.Factory,T extends StandardHttpClientBuilder<C,F,?>>
- java.lang.Object
-
- io.fabric8.kubernetes.client.http.StandardHttpClient<C,F,T>
-
- All Implemented Interfaces:
HttpClient
,Interceptor.RequestTags
,AutoCloseable
public abstract class StandardHttpClient<C extends HttpClient,F extends HttpClient.Factory,T extends StandardHttpClientBuilder<C,F,?>> extends Object implements HttpClient, Interceptor.RequestTags
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.fabric8.kubernetes.client.http.HttpClient
HttpClient.Builder, HttpClient.DerivedClientBuilder, HttpClient.Factory, HttpClient.ProxyType
-
-
Field Summary
Fields Modifier and Type Field Description protected StandardHttpClientBuilder<C,F,T>
builder
protected AtomicBoolean
closed
-
Constructor Summary
Constructors Modifier Constructor Description protected
StandardHttpClient(StandardHttpClientBuilder<C,F,T> builder, AtomicBoolean closed)
-
Method Summary
-
-
-
Field Detail
-
builder
protected StandardHttpClientBuilder<C extends HttpClient,F extends HttpClient.Factory,T extends StandardHttpClientBuilder<C,F,?>> builder
-
closed
protected AtomicBoolean closed
-
-
Constructor Detail
-
StandardHttpClient
protected StandardHttpClient(StandardHttpClientBuilder<C,F,T> builder, AtomicBoolean closed)
-
-
Method Detail
-
buildWebSocketDirect
public abstract CompletableFuture<WebSocketResponse> buildWebSocketDirect(StandardWebSocketBuilder standardWebSocketBuilder, WebSocket.Listener listener)
-
consumeBytesDirect
public abstract CompletableFuture<HttpResponse<AsyncBody>> consumeBytesDirect(StandardHttpRequest request, AsyncBody.Consumer<List<ByteBuffer>> consumer)
-
newBuilder
public HttpClient.DerivedClientBuilder newBuilder()
Description copied from interface:HttpClient
Create a builder that starts with the same state as this client.
The client resources will be shared across derived instances.- Specified by:
newBuilder
in interfaceHttpClient
- Returns:
- a new builder
-
sendAsync
public <V> CompletableFuture<HttpResponse<V>> sendAsync(HttpRequest request, Class<V> type)
Description copied from interface:HttpClient
Send an async request
A Reader or InputStream result must be closed by the caller to properly cleanup resources.
A Reader or InputStream result should not be consumed by the thread completing the returned future as that will hijack a client thread.- Specified by:
sendAsync
in interfaceHttpClient
- Type Parameters:
V
- return type- Parameters:
request
- the HttpRequest to send asynchronouslytype
- one of InputStream, Reader, String, byte[]- Returns:
- a CompletableFuture that returns the resulting HttpResponse when complete
-
consumeBytes
public CompletableFuture<HttpResponse<AsyncBody>> consumeBytes(HttpRequest request, AsyncBody.Consumer<List<ByteBuffer>> consumer)
Description copied from interface:HttpClient
Send a request and consume the bytes of the resulting response bodyHtttpClient implementations will provide ByteBuffers that may be held directly.
- Specified by:
consumeBytes
in interfaceHttpClient
- Parameters:
request
- the HttpRequest to sendconsumer
- the response body consumer- Returns:
- the future which will be ready after the headers have been read
-
newWebSocketBuilder
public WebSocket.Builder newWebSocketBuilder()
- Specified by:
newWebSocketBuilder
in interfaceHttpClient
-
newHttpRequestBuilder
public HttpRequest.Builder newHttpRequestBuilder()
- Specified by:
newHttpRequestBuilder
in interfaceHttpClient
-
getTag
public <V> V getTag(Class<V> type)
- Specified by:
getTag
in interfaceInterceptor.RequestTags
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceHttpClient
-
doClose
protected abstract void doClose()
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceHttpClient
-
getClosed
public AtomicBoolean getClosed()
-
-