public class HttpServer extends Object implements Measured
You receive HTTP requests by providing a requestHandler(io.vertx.core.Handler<io.vertx.rxjava3.core.http.HttpServerRequest>)
. As requests arrive on the server the handler
will be called with the requests.
You receive WebSockets by providing a webSocketHandler(io.vertx.core.Handler<io.vertx.rxjava3.core.http.ServerWebSocket>)
. As WebSocket connections arrive on the server, the
WebSocket is passed to the handler.
original
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static TypeArg<HttpServer> |
__TYPE_ARG |
Constructor and Description |
---|
HttpServer(io.vertx.core.http.HttpServer delegate) |
HttpServer(Object delegate) |
Modifier and Type | Method and Description |
---|---|
int |
actualPort()
The actual port the server is listening on.
|
io.reactivex.rxjava3.core.Completable |
close()
Like
close() but supplying a handler that will be called when the server is actually closed (or has failed). |
HttpServer |
connectionHandler(io.vertx.core.Handler<HttpConnection> handler)
Set a connection handler for the server.
|
boolean |
equals(Object o) |
HttpServer |
exceptionHandler(io.vertx.core.Handler<Throwable> handler)
Set an exception handler called for socket errors happening before the HTTP connection
is established, e.g during the TLS handshake.
|
io.vertx.core.http.HttpServer |
getDelegate() |
int |
hashCode() |
boolean |
isMetricsEnabled()
Whether the metrics are enabled for this measured object
|
io.reactivex.rxjava3.core.Single<HttpServer> |
listen()
Like
listen(int, java.lang.String) but supplying a handler that will be called when the server is actually listening (or has failed). |
io.reactivex.rxjava3.core.Single<HttpServer> |
listen(int port)
Like
listen(int, java.lang.String) but supplying a handler that will be called when the server is actually listening (or has failed). |
io.reactivex.rxjava3.core.Single<HttpServer> |
listen(int port,
String host)
Like
listen(int, java.lang.String) but supplying a handler that will be called when the server is actually
listening (or has failed). |
io.reactivex.rxjava3.core.Single<HttpServer> |
listen(SocketAddress address)
Tell the server to start listening on the given address supplying
a handler that will be called when the server is actually
listening (or has failed).
|
static HttpServer |
newInstance(io.vertx.core.http.HttpServer arg) |
HttpServer |
requestHandler(io.vertx.core.Handler<HttpServerRequest> handler)
Set the request handler for the server to
requestHandler . |
ReadStream<HttpServerRequest> |
requestStream()
Return the request stream for the server.
|
io.reactivex.rxjava3.core.Completable |
rxClose()
Like
close() but supplying a handler that will be called when the server is actually closed (or has failed). |
io.reactivex.rxjava3.core.Single<HttpServer> |
rxListen()
Like
listen(int, java.lang.String) but supplying a handler that will be called when the server is actually listening (or has failed). |
io.reactivex.rxjava3.core.Single<HttpServer> |
rxListen(int port)
Like
listen(int, java.lang.String) but supplying a handler that will be called when the server is actually listening (or has failed). |
io.reactivex.rxjava3.core.Single<HttpServer> |
rxListen(int port,
String host)
Like
listen(int, java.lang.String) but supplying a handler that will be called when the server is actually
listening (or has failed). |
io.reactivex.rxjava3.core.Single<HttpServer> |
rxListen(SocketAddress address)
Tell the server to start listening on the given address supplying
a handler that will be called when the server is actually
listening (or has failed).
|
String |
toString() |
HttpServer |
webSocketHandler(io.vertx.core.Handler<ServerWebSocket> handler)
Set the WebSocket handler for the server to
wsHandler . |
ReadStream<ServerWebSocket> |
webSocketStream()
Return the WebSocket stream for the server.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
newInstance
public static final TypeArg<HttpServer> __TYPE_ARG
public HttpServer(io.vertx.core.http.HttpServer delegate)
public HttpServer(Object delegate)
public io.vertx.core.http.HttpServer getDelegate()
getDelegate
in interface Measured
public boolean isMetricsEnabled()
isMetricsEnabled
in interface Measured
true
if metrics are enabledpublic ReadStream<HttpServerRequest> requestStream()
HttpServerRequest
will be created and passed to the stream .public HttpServer requestHandler(io.vertx.core.Handler<HttpServerRequest> handler)
requestHandler
. As HTTP requests are received by the server,
instances of HttpServerRequest
will be created and passed to this handler.handler
- public HttpServer connectionHandler(io.vertx.core.Handler<HttpConnection> handler)
handler
- public HttpServer exceptionHandler(io.vertx.core.Handler<Throwable> handler)
handler
- the handler to setpublic ReadStream<ServerWebSocket> webSocketStream()
ServerWebSocket
instance will be created and passed to the stream .public HttpServer webSocketHandler(io.vertx.core.Handler<ServerWebSocket> handler)
wsHandler
. If a WebSocket connect handshake is successful a
new ServerWebSocket
instance will be created and passed to the handler.handler
- public io.reactivex.rxjava3.core.Single<HttpServer> listen(int port, String host)
listen(int, java.lang.String)
but supplying a handler that will be called when the server is actually
listening (or has failed).port
- the port to listen onhost
- the host to listen onpublic io.reactivex.rxjava3.core.Single<HttpServer> rxListen(int port, String host)
listen(int, java.lang.String)
but supplying a handler that will be called when the server is actually
listening (or has failed).port
- the port to listen onhost
- the host to listen onpublic io.reactivex.rxjava3.core.Single<HttpServer> listen(SocketAddress address)
address
- the address to listen onpublic io.reactivex.rxjava3.core.Single<HttpServer> rxListen(SocketAddress address)
address
- the address to listen onpublic io.reactivex.rxjava3.core.Single<HttpServer> listen(int port)
listen(int, java.lang.String)
but supplying a handler that will be called when the server is actually listening (or has failed).port
- the port to listen onpublic io.reactivex.rxjava3.core.Single<HttpServer> rxListen(int port)
listen(int, java.lang.String)
but supplying a handler that will be called when the server is actually listening (or has failed).port
- the port to listen onpublic io.reactivex.rxjava3.core.Single<HttpServer> listen()
listen(int, java.lang.String)
but supplying a handler that will be called when the server is actually listening (or has failed).public io.reactivex.rxjava3.core.Single<HttpServer> rxListen()
listen(int, java.lang.String)
but supplying a handler that will be called when the server is actually listening (or has failed).public io.reactivex.rxjava3.core.Completable close()
close()
but supplying a handler that will be called when the server is actually closed (or has failed).public io.reactivex.rxjava3.core.Completable rxClose()
close()
but supplying a handler that will be called when the server is actually closed (or has failed).public int actualPort()
public static HttpServer newInstance(io.vertx.core.http.HttpServer arg)
Copyright © 2021 Eclipse. All rights reserved.