I - The type of the content of request.O - The type of the content of response.public abstract class HttpClient<I,O> extends InterceptingHttpClient<I,O>
| Constructor and Description |
|---|
HttpClient() |
| Modifier and Type | Method and Description |
|---|---|
abstract <II,OO> HttpClient<II,OO> |
addChannelHandlerAfter(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String baseName,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <II,OO> HttpClient<II,OO> |
addChannelHandlerAfter(java.lang.String baseName,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <II,OO> HttpClient<II,OO> |
addChannelHandlerBefore(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String baseName,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <II,OO> HttpClient<II,OO> |
addChannelHandlerBefore(java.lang.String baseName,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <II,OO> HttpClient<II,OO> |
addChannelHandlerFirst(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <II,OO> HttpClient<II,OO> |
addChannelHandlerFirst(java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <II,OO> HttpClient<II,OO> |
addChannelHandlerLast(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <II,OO> HttpClient<II,OO> |
addChannelHandlerLast(java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <T> HttpClient<I,O> |
channelOption(io.netty.channel.ChannelOption<T> option,
T value)
Creates a new client instances, inheriting all configurations from this client and adding a
ChannelOption for the connections created by the newly created client instance. |
abstract HttpClient<I,O> |
channelProvider(io.reactivex.netty.client.ChannelProviderFactory providerFactory)
Creates a new client instance, inheriting all configurations from this client and using the passed
providerFactory. |
abstract HttpClient<I,O> |
enableWireLogging(io.netty.handler.logging.LogLevel wireLoggingLevel)
Creates a new client instances, inheriting all configurations from this client and enabling wire logging at the
passed level for the newly created client instance.
|
abstract HttpClient<I,O> |
followRedirects(boolean follow)
Creates a new client instances, inheriting all configurations from this client and enabling/disabling redirects
for all requests created by the newly created client instance.
|
abstract HttpClient<I,O> |
followRedirects(int maxRedirects)
Creates a new client instances, inheriting all configurations from this client and following the passed number of
max HTTP redirects.
|
static HttpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> |
newClient(io.reactivex.netty.client.ConnectionProviderFactory<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> providerFactory,
rx.Observable<io.reactivex.netty.client.Host> hostStream)
Creates a new HTTP client instance using the supplied connection provider.
|
static HttpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> |
newClient(java.net.SocketAddress serverAddress)
Creates a new HTTP client instance with the passed address of the target server.
|
static HttpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> |
newClient(java.lang.String host,
int port)
Creates a new HTTP client instance with the passed host and port for the target server.
|
abstract <II,OO> HttpClient<II,OO> |
pipelineConfigurator(rx.functions.Action1<io.netty.channel.ChannelPipeline> pipelineConfigurator)
Creates a new client instances, inheriting all configurations from this client and using the passed
action to configure all the connections created by the newly created client instance.
|
abstract HttpClient<I,O> |
readTimeOut(int timeOut,
java.util.concurrent.TimeUnit timeUnit)
Creates a new client instances, inheriting all configurations from this client and adding the passed read timeout
for all requests created by the newly created client instance.
|
abstract HttpClient<I,O> |
secure(rx.functions.Func1<io.netty.buffer.ByteBufAllocator,javax.net.ssl.SSLEngine> sslEngineFactory)
Creates a new client instance, inheriting all configurations from this client and using the passed
sslEngineFactory for all secured connections created by the newly created client instance. |
abstract HttpClient<I,O> |
secure(io.reactivex.netty.ssl.SslCodec sslCodec)
Creates a new client instance, inheriting all configurations from this client and using the passed
sslCodec for all secured connections created by the newly created client instance. |
abstract HttpClient<I,O> |
secure(javax.net.ssl.SSLEngine sslEngine)
Creates a new client instance, inheriting all configurations from this client and using the passed
sslEngine for all secured connections created by the newly created client instance. |
abstract HttpClient<I,O> |
unsafeSecure()
Creates a new client instance, inheriting all configurations from this client and using a trust-all
TrustManagerFactoryfor all secured connections created by the newly created client instance. |
createConnect, createDelete, createGet, createHead, createOptions, createPatch, createPost, createPut, createRequest, createRequest, createTrace, interceptpublic abstract HttpClient<I,O> readTimeOut(int timeOut, java.util.concurrent.TimeUnit timeUnit)
timeOut - Read timeout duration.timeUnit - Timeunit for the timeout.HttpClient instance.public abstract <T> HttpClient<I,O> channelOption(io.netty.channel.ChannelOption<T> option, T value)
ChannelOption for the connections created by the newly created client instance.option - Option to add.value - Value for the option.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> addChannelHandlerFirst(java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler to ChannelPipeline for all connections created by this client. The specified
handler is added at the first position of the pipeline as specified by
ChannelPipeline.addFirst(String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1) will be more
convenient.name - Name of the handler.handlerFactory - Factory to create handler instance to add.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> addChannelHandlerFirst(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler to ChannelPipeline for all connections created by this client. The specified
handler is added at the first position of the pipeline as specified by
ChannelPipeline.addFirst(EventExecutorGroup, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1) will be more
convenient.group - the EventExecutorGroup which will be used to execute the ChannelHandler
methodsname - the name of the handler to appendhandlerFactory - Factory to create handler instance to add.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> addChannelHandlerLast(java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler to ChannelPipeline for all connections created by this client. The specified
handler is added at the last position of the pipeline as specified by
ChannelPipeline.addLast(String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1) will be more
convenient.name - Name of the handler.handlerFactory - Factory to create handler instance to add.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> addChannelHandlerLast(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler to ChannelPipeline for all connections created by this client. The specified
handler is added at the last position of the pipeline as specified by
ChannelPipeline.addLast(EventExecutorGroup, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1) will be more
convenient.group - the EventExecutorGroup which will be used to execute the ChannelHandler
methodsname - the name of the handler to appendhandlerFactory - Factory to create handler instance to add.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> addChannelHandlerBefore(java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler to ChannelPipeline for all connections created by this client. The specified
handler is added before an existing handler with the passed baseName in the pipeline as specified by
ChannelPipeline.addBefore(String, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1) will be more
convenient.baseName - the name of the existing handlername - Name of the handler.handlerFactory - Factory to create handler instance to add.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> addChannelHandlerBefore(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler to ChannelPipeline for all connections created by this client. The specified
handler is added before an existing handler with the passed baseName in the pipeline as specified by
ChannelPipeline.addBefore(EventExecutorGroup, String, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1) will be more
convenient.group - the EventExecutorGroup which will be used to execute the ChannelHandler
methodsbaseName - the name of the existing handlername - the name of the handler to appendhandlerFactory - Factory to create handler instance to add.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> addChannelHandlerAfter(java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler to ChannelPipeline for all connections created by this client. The specified
handler is added after an existing handler with the passed baseName in the pipeline as specified by
ChannelPipeline.addAfter(String, String, ChannelHandler)baseName - the name of the existing handlername - Name of the handler.handlerFactory - Factory to create handler instance to add.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> addChannelHandlerAfter(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler to ChannelPipeline for all connections created by this client. The specified
handler is added after an existing handler with the passed baseName in the pipeline as specified by
ChannelPipeline.addAfter(EventExecutorGroup, String, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1) will be more
convenient.group - the EventExecutorGroup which will be used to execute the ChannelHandler
methodsbaseName - the name of the existing handlername - the name of the handler to appendhandlerFactory - Factory to create handler instance to add.HttpClient instance.public abstract <II,OO> HttpClient<II,OO> pipelineConfigurator(rx.functions.Action1<io.netty.channel.ChannelPipeline> pipelineConfigurator)
pipelineConfigurator - Action to configure ChannelPipeline.HttpClient instance.public abstract HttpClient<I,O> secure(rx.functions.Func1<io.netty.buffer.ByteBufAllocator,javax.net.ssl.SSLEngine> sslEngineFactory)
sslEngineFactory for all secured connections created by the newly created client instance.
If the SSLEngine instance can be statically, created, secure(SSLEngine) can be used.sslEngineFactory - Factory for all secured connections created by the newly created client instance.HttpClient instance.public abstract HttpClient<I,O> secure(javax.net.ssl.SSLEngine sslEngine)
sslEngine for all secured connections created by the newly created client instance.
If the SSLEngine instance can not be statically, created, secure(Func1) )} can be used.sslEngine - SSLEngine for all secured connections created by the newly created client instance.HttpClient instance.public abstract HttpClient<I,O> secure(io.reactivex.netty.ssl.SslCodec sslCodec)
sslCodec for all secured connections created by the newly created client instance.
This is required only when the SslHandler used by SslCodec is to be modified before adding to
the ChannelPipeline. For most of the cases, secure(Func1) or secure(SSLEngine) will be
enough.sslCodec - SslCodec for all secured connections created by the newly created client instance.HttpClient instance.public abstract HttpClient<I,O> unsafeSecure()
TrustManagerFactoryfor all secured connections created by the newly created client instance.
This is only for testing and should not be used for real production clients.HttpClient instance.public abstract HttpClient<I,O> enableWireLogging(io.netty.handler.logging.LogLevel wireLoggingLevel)
wireLoggingLevel - Logging level at which the wire logs will be logged. The wire logging will only be done if
logging is enabled at this level for LoggingHandlerHttpClient instance.public abstract HttpClient<I,O> channelProvider(io.reactivex.netty.client.ChannelProviderFactory providerFactory)
providerFactory.providerFactory - Channel provider factory.HttpClient instance.public static HttpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> newClient(java.lang.String host, int port)
host - Hostname for the target server.port - Port for the target server.HttpClient instance.public static HttpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> newClient(java.net.SocketAddress serverAddress)
serverAddress - Socket address for the target server.HttpClient instance.public static HttpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> newClient(io.reactivex.netty.client.ConnectionProviderFactory<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> providerFactory, rx.Observable<io.reactivex.netty.client.Host> hostStream)
providerFactory - ConnectionProviderFactory for the client.hostStream - Stream of hosts for the client.HttpClient instance.public abstract HttpClient<I,O> followRedirects(int maxRedirects)
maxRedirects - Maximum number of redirects to follow for any request.HttpClient instance.public abstract HttpClient<I,O> followRedirects(boolean follow)
follow - true to follow redirects. false to disable any redirects.HttpClient instance.