public class RxHttpClient
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RxHttpClient.Builder
A Builder for
RxHttpClient builders. |
| Modifier | Constructor and Description |
|---|---|
protected |
RxHttpClient(com.ning.http.client.AsyncHttpClient innerClient,
be.wegenenverkeer.rxhttp.RxHttpClient.RestClientConfig config) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying connection
|
<F> java.util.concurrent.CompletableFuture<F> |
execute(ClientRequest request,
java.util.function.Function<ServerResponse,F> transformer)
Executes a request and returns an Observable for the complete response.
|
rx.Observable<ServerResponseElement> |
executeObservably(ClientRequest request)
Returns a "cold" Observable for a stream of
ServerResponseElements. |
<F> rx.Observable<F> |
executeObservably(ClientRequest request,
java.util.function.Function<byte[],F> transform)
Returns a "cold" Observable for a stream of
T. |
<F> rx.Observable<F> |
executeToCompletion(ClientRequest request,
java.util.function.Function<ServerResponse,F> transformer)
Executes a request and returns an Observable for the complete response.
|
java.lang.String |
getAccept()
Returns the configured default ACCEPT header for requests created using this instance's
ClientRequestBuilders. |
java.lang.String |
getBaseUrl()
Returns the base URL that this client connects to.
|
ClientRequestBuilder |
requestBuilder()
Returns a new
ClientRequestBuilder. |
protected RxHttpClient(com.ning.http.client.AsyncHttpClient innerClient,
be.wegenenverkeer.rxhttp.RxHttpClient.RestClientConfig config)
public <F> java.util.concurrent.CompletableFuture<F> execute(ClientRequest request, java.util.function.Function<ServerResponse,F> transformer)
public <F> rx.Observable<F> executeToCompletion(ClientRequest request, java.util.function.Function<ServerResponse,F> transformer)
When available, the complete response will be presented to any subscriber. Only one HTTP request will be made, regardless of the number of subscribers.
F - the type of return valuerequest - the request to sendtransformer - a function that transforms the ServerResponse to a value of Fpublic rx.Observable<ServerResponseElement> executeObservably(ClientRequest request)
ServerResponseElements.
The returned Observable is "deferred", i.e. on each subscription a new HTTP request is made and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made.
request - the request to sendObservable.defer(rx.functions.Func0<rx.Observable<T>>)public <F> rx.Observable<F> executeObservably(ClientRequest request, java.util.function.Function<byte[],F> transform)
T.
The returned Observable is "deferred", i.e. on each subscription a new HTTP request is made and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made.
F - return type of the transformrequest - the request to sendtransform - the function that transforms the response body (chunks) into objects of type FObservable.defer(rx.functions.Func0<rx.Observable<T>>)public java.lang.String getBaseUrl()
public java.lang.String getAccept()
ClientRequestBuilders.ClientRequestBuilders.public void close()
public ClientRequestBuilder requestBuilder()
ClientRequestBuilder.ClientRequestBuilder.