public final class HttpServerImpl<I,O> extends HttpServer<I,O>
| Modifier and Type | Method and Description |
|---|---|
<II,OO> HttpServer<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 server. |
<II,OO> HttpServer<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 server. |
<II,OO> HttpServer<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 server. |
<II,OO> HttpServer<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 server. |
<II,OO> HttpServer<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 server. |
<II,OO> HttpServer<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
server. |
<II,OO> HttpServer<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 server. |
<II,OO> HttpServer<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 server. |
void |
awaitShutdown()
Waits for the shutdown of this server.
|
void |
awaitShutdown(long duration,
java.util.concurrent.TimeUnit timeUnit)
Waits for the shutdown of this server, waiting a maximum of the passed duration.
|
<T> HttpServer<I,O> |
channelOption(io.netty.channel.ChannelOption<T> option,
T value)
Creates a new server instance, inheriting all configurations from this server and adding a
ChannelOption
for the server socket created by the newly created server instance. |
<T> HttpServer<I,O> |
clientChannelOption(io.netty.channel.ChannelOption<T> option,
T value)
Creates a new server instance, inheriting all configurations from this server and adding a
ChannelOption
for the client socket created by the newly created server instance. |
HttpServer<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.
|
java.net.SocketAddress |
getServerAddress()
Returns the address at which this server is running.
|
int |
getServerPort()
Returns the port at which this server is running.
|
<II,OO> HttpServer<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.
|
HttpServer<I,O> |
secure(rx.functions.Func1<io.netty.buffer.ByteBufAllocator,javax.net.ssl.SSLEngine> sslEngineFactory)
Creates a new server instances, inheriting all configurations from this server and using the passed
sslEngineFactory for all secured connections accepted by the newly created server instance. |
HttpServer<I,O> |
secure(io.reactivex.netty.ssl.SslCodec sslCodec)
Creates a new server instances, inheriting all configurations from this server and using the passed
sslCodec for all secured connections accepted by the newly created server instance. |
HttpServer<I,O> |
secure(javax.net.ssl.SSLEngine sslEngine)
Creates a new server instances, inheriting all configurations from this server and using the passed
sslEngine for all secured connections accepted by the newly created server instance. |
HttpServer<I,O> |
sendHttp10ResponseFor10Request(boolean sendHttp10ResponseFor10Request)
According to the specification, an HTTP server must
send the highest HTTP version response, it is compatible with.
|
void |
shutdown()
Shutdown this server and waits till the server socket is closed.
|
HttpServer<I,O> |
start(RequestHandler<I,O> requestHandler)
Starts this server.
|
rx.Subscription |
subscribe(HttpServerEventsListener listener) |
HttpServer<I,O> |
unsafeSecure()
Creates a new server instances, inheriting all configurations from this server and using a self-signed
certificate for all secured connections accepted by the newly created server instance.
|
public <T> HttpServer<I,O> channelOption(io.netty.channel.ChannelOption<T> option, T value)
HttpServerChannelOption
for the server socket created by the newly created server instance.channelOption in class HttpServer<I,O>option - Option to add.value - Value for the option.HttpServer instance.public <T> HttpServer<I,O> clientChannelOption(io.netty.channel.ChannelOption<T> option, T value)
HttpServerChannelOption
for the client socket created by the newly created server instance.clientChannelOption in class HttpServer<I,O>option - Option to add.value - Value for the option.HttpServer instance.public <II,OO> HttpServer<II,OO> addChannelHandlerFirst(java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
HttpServerChannelHandler to ChannelPipeline for all connections created by this
server. 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 HttpServer.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerFirst in class HttpServer<I,O>name - Name of the handler.handlerFactory - Factory to create handler instance to add.HttpServer instance.public <II,OO> HttpServer<II,OO> addChannelHandlerFirst(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
HttpServerChannelHandler to ChannelPipeline for all connections created by this server. 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 HttpServer.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerFirst in class HttpServer<I,O>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.HttpServer instance.public <II,OO> HttpServer<II,OO> addChannelHandlerLast(java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
HttpServerChannelHandler to ChannelPipeline for all connections created by this server. 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 HttpServer.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerLast in class HttpServer<I,O>name - Name of the handler.handlerFactory - Factory to create handler instance to add.HttpServer instance.public <II,OO> HttpServer<II,OO> addChannelHandlerLast(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
HttpServerChannelHandler to ChannelPipeline for all connections created by this server. 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 HttpServer.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerLast in class HttpServer<I,O>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.HttpServer instance.public <II,OO> HttpServer<II,OO> addChannelHandlerBefore(java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
HttpServerChannelHandler to ChannelPipeline for all connections created by this server. 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 HttpServer.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerBefore in class HttpServer<I,O>baseName - the name of the existing handlername - Name of the handler.handlerFactory - Factory to create handler instance to add.HttpServer instance.public <II,OO> HttpServer<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)
HttpServerChannelHandler to ChannelPipeline for all connections created by this server. 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 HttpServer.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerBefore in class HttpServer<I,O>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.HttpServer instance.public <II,OO> HttpServer<II,OO> addChannelHandlerAfter(java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
HttpServerChannelHandler to ChannelPipeline for all connections created by this server. The
specified handler is added after an existing handler with the passed baseName in the pipeline as
specified by ChannelPipeline.addAfter(String, String, ChannelHandler)
For better flexibility of pipeline modification, the method HttpServer.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerAfter in class HttpServer<I,O>baseName - the name of the existing handlername - Name of the handler.handlerFactory - Factory to create handler instance to add.HttpServer instance.public <II,OO> HttpServer<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)
HttpServerChannelHandler to ChannelPipeline for all connections created by this server. 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 HttpServer.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerAfter in class HttpServer<I,O>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.HttpServer instance.public <II,OO> HttpServer<II,OO> pipelineConfigurator(rx.functions.Action1<io.netty.channel.ChannelPipeline> pipelineConfigurator)
HttpServerpipelineConfigurator in class HttpServer<I,O>pipelineConfigurator - Action to configure ChannelPipeline.HttpServer instance.public HttpServer<I,O> secure(rx.functions.Func1<io.netty.buffer.ByteBufAllocator,javax.net.ssl.SSLEngine> sslEngineFactory)
HttpServersslEngineFactory for all secured connections accepted by the newly created server instance.
If the SSLEngine instance can be statically, created, HttpServer.secure(SSLEngine) can be used.secure in class HttpServer<I,O>sslEngineFactory - Factory for all secured connections created by the newly created server instance.HttpServer instance.public HttpServer<I,O> secure(javax.net.ssl.SSLEngine sslEngine)
HttpServersslEngine for all secured connections accepted by the newly created server instance.
If the SSLEngine instance can not be statically, created, HttpServer.secure(Func1) )} can be used.secure in class HttpServer<I,O>sslEngine - SSLEngine for all secured connections created by the newly created server instance.HttpServer instance.public HttpServer<I,O> secure(io.reactivex.netty.ssl.SslCodec sslCodec)
HttpServersslCodec for all secured connections accepted by the newly created server 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, HttpServer.secure(Func1) or HttpServer.secure(SSLEngine) will be
enough.secure in class HttpServer<I,O>sslCodec - SslCodec for all secured connections created by the newly created server instance.HttpServer instance.public HttpServer<I,O> unsafeSecure()
HttpServerunsafeSecure in class HttpServer<I,O>HttpServer instance.public HttpServer<I,O> enableWireLogging(io.netty.handler.logging.LogLevel wireLoggingLevel)
HttpServerenableWireLogging in class HttpServer<I,O>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 LoggingHandlerHttpServer instance.public HttpServer<I,O> sendHttp10ResponseFor10Request(boolean sendHttp10ResponseFor10Request)
HttpServersendHttp10ResponseFor10Request in class HttpServer<I,O>sendHttp10ResponseFor10Request - If true then sends 1.0 version response for 1.0 request.HttpServer instance.public int getServerPort()
HttpServergetServerPort in class HttpServer<I,O>public java.net.SocketAddress getServerAddress()
HttpServergetServerAddress in class HttpServer<I,O>public HttpServer<I,O> start(RequestHandler<I,O> requestHandler)
HttpServerstart in class HttpServer<I,O>requestHandler - Connection handler that will handle any new client connections to this server.public void shutdown()
HttpServershutdown in class HttpServer<I,O>public void awaitShutdown()
HttpServerawaitShutdown in class HttpServer<I,O>public void awaitShutdown(long duration,
java.util.concurrent.TimeUnit timeUnit)
HttpServerawaitShutdown in class HttpServer<I,O>duration - Duration to wait for shutdown.timeUnit - Timeunit for the duration to wait for shutdown.public rx.Subscription subscribe(HttpServerEventsListener listener)