public class HttpServerImpl extends Object implements HttpServer, Closeable
This class is thread-safe
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)
Close the server.
|
protected void |
finalize() |
HttpServer |
listen() |
HttpServer |
listen(Handler<AsyncResult<HttpServer>> listenHandler) |
String |
metricBaseName()
The metric base name
|
Map<String,JsonObject> |
metrics()
Will return the metrics that correspond with this measured object.
|
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)
HttpServer
Set the request handler for the server to requestHandler
. As HTTP requests are received by the server,
instances of HttpServerRequest
will be created and passed to this handler.
requestHandler
in interface HttpServer
public HttpServerRequestStream requestStream()
HttpServer
Return the request stream for the server. As HTTP requests are received by the server,
instances of HttpServerRequest
will be created and passed to this stream ReadStream.handler(io.vertx.core.Handler)
.
requestStream
in interface HttpServer
public HttpServer websocketHandler(Handler<ServerWebSocket> handler)
HttpServer
Set the websocket handler for the server to wsHandler
. If a websocket connect handshake is successful a
new ServerWebSocket
instance will be created and passed to the handler.
websocketHandler
in interface HttpServer
public Handler<HttpServerRequest> requestHandler()
requestHandler
in interface HttpServer
public Handler<ServerWebSocket> websocketHandler()
websocketHandler
in interface HttpServer
public ServerWebSocketStream websocketStream()
HttpServer
Return the websocket stream for the server. If a websocket connect handshake is successful a
new ServerWebSocket
instance will be created and passed to this stream ReadStream.handler(io.vertx.core.Handler)
.
websocketStream
in interface HttpServer
public HttpServer listen()
listen
in interface HttpServer
public HttpServer listen(Handler<AsyncResult<HttpServer>> listenHandler)
listen
in interface HttpServer
public void close()
HttpServer
Close the server. Any open HTTP connections will be closed.
close
in interface HttpServer
public void close(Handler<AsyncResult<Void>> done)
HttpServer
Close the server. Any open HTTP connections will be closed. The completionHandler
will be called when the close
is complete.
close
in interface HttpServer
close
in interface Closeable
public String metricBaseName()
Measured
The metric base name
metricBaseName
in interface Measured
public Map<String,JsonObject> metrics()
Measured
Will return the metrics that correspond with this measured object.
Copyright © 2015. All Rights Reserved.