public class HttpServerImpl extends Object implements HttpServer, Closeable, MetricsProvider
| Modifier and Type | Class and Description |
|---|---|
class |
HttpServerImpl.ServerHandler |
| Constructor and Description |
|---|
HttpServerImpl(VertxInternal vertx,
HttpServerOptions options) |
| Modifier and Type | Method and Description |
|---|---|
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). |
protected void |
finalize() |
Metrics |
getMetrics()
Returns the metrics implementation.
|
boolean |
isMetricsEnabled()
Whether the metrics are enabled for this measured object
|
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). |
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). |
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). |
Handler<HttpServerRequest> |
requestHandler() |
HttpServer |
requestHandler(Handler<HttpServerRequest> handler)
Set the request handler for the server to
requestHandler. |
HttpServerRequestStream |
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. |
ServerWebSocketStream |
websocketStream()
Return the websocket stream for the server.
|
public HttpServerImpl(VertxInternal vertx, HttpServerOptions options)
public 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 HttpServerRequestStream 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 Handler<ServerWebSocket> websocketHandler()
websocketHandler in interface HttpServerpublic ServerWebSocketStream websocketStream()
HttpServerServerWebSocket instance will be created and passed to the stream ReadStream.handler(io.vertx.core.Handler).websocketStream in interface HttpServerpublic 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 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)
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 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 void close()
HttpServerThe close happens asynchronously and the server may not be closed until some time after the call has returned.
close in interface HttpServerpublic 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 HttpServerclose in interface Closeabledone - the handlerpublic Metrics getMetrics()
MetricsProvidergetMetrics in interface MetricsProviderpublic boolean isMetricsEnabled()
MeasuredisMetricsEnabled in interface MeasuredCopyright © 2015. All Rights Reserved.