public class HttpServerImpl extends TCPServerBase implements HttpServer, Closeable, MetricsProvider
creatingContext, sslHelper, vertx| Constructor and Description |
|---|
HttpServerImpl(VertxInternal vertx,
HttpServerOptions options) |
| Modifier and Type | Method and Description |
|---|---|
Future<Void> |
close()
Close the server.
|
void |
close(Handler<AsyncResult<Void>> done)
Like
HttpServer.close() but supplying a handler that will be called when the server is actually closed (or has failed). |
void |
close(Promise<Void> completion)
Close this resource, the
completion promise must be notified when the operation has completed. |
HttpServer |
connectionHandler(Handler<HttpConnection> handler)
Set a connection handler for the server.
|
protected TCPMetrics<?> |
createMetrics(SocketAddress localAddress) |
HttpServer |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler called for socket errors happening before the HTTP connection
is established, e.g during the TLS handshake.
|
SSLHelper |
getSslHelper() |
boolean |
isClosed() |
Future<HttpServer> |
listen()
Tell the server to start listening.
|
HttpServer |
listen(Handler<AsyncResult<HttpServer>> listenHandler)
Like
HttpServer.listen() but supplying a handler that will be called when the server is actually listening (or has failed). |
Future<HttpServer> |
listen(int port)
Like
HttpServer.listen(int, String) but the server will listen on host "0.0.0.0" and port specified here ignoring
any value in the HttpServerOptions that was used when creating the server. |
HttpServer |
listen(int port,
Handler<AsyncResult<HttpServer>> listenHandler)
Like
HttpServer.listen(int) but supplying a handler that will be called when the server is actually listening (or has failed). |
Future<HttpServer> |
listen(int port,
String host)
Tell the server to start listening.
|
HttpServer |
listen(int port,
String host,
Handler<AsyncResult<HttpServer>> listenHandler)
Like
HttpServer.listen(int, String) but supplying a handler that will be called when the server is actually
listening (or has failed). |
Future<HttpServer> |
listen(SocketAddress address)
Like
HttpServer.listen(SocketAddress, Handler) but returns a Future of the asynchronous result |
HttpServer |
listen(SocketAddress address,
Handler<AsyncResult<HttpServer>> listenHandler)
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).
|
Handler<HttpServerRequest> |
requestHandler() |
HttpServer |
requestHandler(Handler<HttpServerRequest> handler)
Set the request handler for the server to
requestHandler. |
ReadStream<HttpServerRequest> |
requestStream()
Return the request stream for the server.
|
Handler<ServerWebSocket> |
webSocketHandler() |
HttpServer |
webSocketHandler(Handler<ServerWebSocket> handler)
Set the WebSocket handler for the server to
wsHandler. |
ReadStream<ServerWebSocket> |
webSocketStream()
Return the WebSocket stream for the server.
|
actualPort, closeAll, finalize, getMetrics, isListening, isMetricsEnabled, listenclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitactualPortgetMetricsisMetricsEnabledpublic HttpServerImpl(VertxInternal vertx, HttpServerOptions options)
protected TCPMetrics<?> createMetrics(SocketAddress localAddress)
createMetrics in class TCPServerBasepublic HttpServer requestHandler(Handler<HttpServerRequest> handler)
HttpServerrequestHandler. As HTTP requests are received by the server,
instances of HttpServerRequest will be created and passed to this handler.requestHandler in interface HttpServerpublic ReadStream<HttpServerRequest> requestStream()
HttpServerHttpServerRequest will be created and passed to the stream ReadStream.handler(io.vertx.core.Handler).requestStream in interface HttpServerpublic HttpServer webSocketHandler(Handler<ServerWebSocket> handler)
HttpServerwsHandler. If a WebSocket connect handshake is successful a
new ServerWebSocket instance will be created and passed to the handler.webSocketHandler in interface HttpServerpublic Handler<HttpServerRequest> requestHandler()
requestHandler in interface HttpServerpublic HttpServer connectionHandler(Handler<HttpConnection> handler)
HttpServerconnectionHandler in interface HttpServerpublic HttpServer exceptionHandler(Handler<Throwable> handler)
HttpServerexceptionHandler in interface HttpServerhandler - the handler to setpublic Handler<ServerWebSocket> webSocketHandler()
webSocketHandler in interface HttpServerpublic ReadStream<ServerWebSocket> webSocketStream()
HttpServerServerWebSocket instance will be created and passed to the stream ReadStream.handler(io.vertx.core.Handler).webSocketStream in interface HttpServerpublic Future<HttpServer> listen()
HttpServerHttpServerOptions that was used when creating the server.
The listen happens asynchronously and the server may not be listening until some time after the call has returned.
listen in interface HttpServerpublic HttpServer listen(Handler<AsyncResult<HttpServer>> listenHandler)
HttpServerHttpServer.listen() but supplying a handler that will be called when the server is actually listening (or has failed).listen in interface HttpServerlistenHandler - the listen handlerpublic Future<HttpServer> listen(int port, String host)
HttpServerHttpServerOptions that was used when creating the server.
The listen happens asynchronously and the server may not be listening until some time after the call has returned.
listen in interface HttpServerport - the port to listen onhost - the host to listen onpublic HttpServer listen(int port, String host, Handler<AsyncResult<HttpServer>> listenHandler)
HttpServerHttpServer.listen(int, String) but supplying a handler that will be called when the server is actually
listening (or has failed).listen in interface HttpServerport - the port to listen onhost - the host to listen onlistenHandler - the listen handlerpublic Future<HttpServer> listen(int port)
HttpServerHttpServer.listen(int, String) but the server will listen on host "0.0.0.0" and port specified here ignoring
any value in the HttpServerOptions that was used when creating the server.listen in interface HttpServerport - the port to listen onpublic HttpServer listen(int port, Handler<AsyncResult<HttpServer>> listenHandler)
HttpServerHttpServer.listen(int) but supplying a handler that will be called when the server is actually listening (or has failed).listen in interface HttpServerport - the port to listen onlistenHandler - the listen handlerpublic Future<HttpServer> listen(SocketAddress address)
HttpServerHttpServer.listen(SocketAddress, Handler) but returns a Future of the asynchronous resultlisten in interface HttpServerpublic HttpServer listen(SocketAddress address, Handler<AsyncResult<HttpServer>> listenHandler)
HttpServerlisten in interface HttpServeraddress - the address to listen onlistenHandler - the listen handlerpublic Future<Void> close()
HttpServerThe close happens asynchronously and the server may not be closed until some time after the call has returned.
close in interface HttpServerclose in class TCPServerBasepublic void close(Handler<AsyncResult<Void>> done)
HttpServerHttpServer.close() but supplying a handler that will be called when the server is actually closed (or has failed).close in interface HttpServerdone - the handlerpublic void close(Promise<Void> completion)
Closeablecompletion promise must be notified when the operation has completed.close in interface Closeableclose in class TCPServerBasecompletion - the promise to signal when close has completedpublic boolean isClosed()
public SSLHelper getSslHelper()
Copyright © 2021. All rights reserved.