Package be.wegenenverkeer.rxhttpclient
Class BaseRxHttpClient
- java.lang.Object
-
- be.wegenenverkeer.rxhttpclient.BaseRxHttpClient
-
- All Implemented Interfaces:
RxHttpClient,java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
RxJavaHttpClient
public abstract class BaseRxHttpClient extends java.lang.Object implements RxHttpClient
A Reactive HTTP Client Created by Karel Maesen, Geovise BVBA on 05/12/14.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseRxHttpClient(org.asynchttpclient.AsyncHttpClient innerClient, RestClientConfig config, ClientRequestLogFormatter logFmt, RequestSigner... requestSigners)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()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.org.reactivestreams.Publisher<java.lang.String>executeAndDechunk(ClientRequest request, java.lang.String separator)Returns a "cold" Observable for a stream of messages.java.lang.StringgetAccept()Returns the configured default ACCEPT header for requests created using this instance'sClientRequestBuilders.java.lang.StringgetBaseUrl()Returns the base URL that this client connects to.intgetMaxConnections()java.util.List<RequestSigner>getRequestSigners()org.asynchttpclient.AsyncHttpClientinner()ClientRequestBuilderrequestBuilder()Returns a newClientRequestBuilder.java.lang.StringtoLogMessage(ClientRequest request)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface be.wegenenverkeer.rxhttpclient.RxHttpClient
executeAndDechunk, executeObservably, executeObservably, executeToCompletion
-
-
-
-
Constructor Detail
-
BaseRxHttpClient
protected BaseRxHttpClient(org.asynchttpclient.AsyncHttpClient innerClient, RestClientConfig config, ClientRequestLogFormatter logFmt, RequestSigner... requestSigners)
-
-
Method Detail
-
execute
public <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.- Specified by:
executein interfaceRxHttpClient
-
executeAndDechunk
public org.reactivestreams.Publisher<java.lang.String> executeAndDechunk(ClientRequest request, java.lang.String separator)
Returns a "cold" Observable for a stream of messages.All
ServerResponseElements are filtered out,ResponseBodyParts are turned into (UTF8)Strings, and the chunks are combined and split at the specified separator characters.The returned Observable is Cold, 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.
- Specified by:
executeAndDechunkin interfaceRxHttpClient- Parameters:
request- the request to sendseparator- the separator- Returns:
- a cold Flowable of messages (UTF8 Strings)
-
getBaseUrl
public java.lang.String getBaseUrl()
Returns the base URL that this client connects to.- Specified by:
getBaseUrlin interfaceRxHttpClient- Returns:
- the base URL that this client connects to.
-
getAccept
public java.lang.String getAccept()
Returns the configured default ACCEPT header for requests created using this instance'sClientRequestBuilders.- Specified by:
getAcceptin interfaceRxHttpClient- Returns:
- the configured default ACCEPT header for requests created using this instance's
ClientRequestBuilders.
-
getRequestSigners
public java.util.List<RequestSigner> getRequestSigners()
- Specified by:
getRequestSignersin interfaceRxHttpClient
-
close
public void close()
Closes the underlying connection- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceRxHttpClient
-
requestBuilder
public ClientRequestBuilder requestBuilder()
Returns a newClientRequestBuilder.- Specified by:
requestBuilderin interfaceRxHttpClient- Returns:
- a new
ClientRequestBuilder.
-
toLogMessage
public java.lang.String toLogMessage(ClientRequest request)
- Specified by:
toLogMessagein interfaceRxHttpClient
-
inner
public org.asynchttpclient.AsyncHttpClient inner()
- Specified by:
innerin interfaceRxHttpClient
-
getMaxConnections
public int getMaxConnections()
- Specified by:
getMaxConnectionsin interfaceRxHttpClient
-
-