You receive HTTP requests by providing a requestHandler. As requests arrive on the server the handler
will be called with the requests.
You receive WebSockets by providing a webSocketHandler. As WebSocket connections arrive on the server, the
WebSocket is passed to the handler.
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the actual port the server is listening on.The actual port the server is listening on. |
| public Future | |
| public void | close(Handler<AsyncResult<Void>>
the handler completionHandler)Like |
| public HttpServer | Returns: a reference to this, so the API can be used fluentlySet a connection handler for the server. |
| public HttpServer | Returns: a reference to this, so the API can be used fluentlythe handler to set handler)Set an exception handler called for socket errors happening before the HTTP connection is established, e.g during the TLS handshake. |
| public HttpServer | Returns: a reference to this, so the API can be used fluentlySet a |
| public Future | Returns: a future completed with the listen operation resultTell the server to start listening. |
| public default Future | |
| public default HttpServer | listen(int
the port to listen on port, String the host to listen on host, Handler<AsyncResult<HttpServer>> the listen handler listenHandler)Like |
| public default HttpServer | listen(SocketAddress
the address to listen on address, Handler<AsyncResult<HttpServer>> the listen handler 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). |
| public Future | listen(SocketAddress address)
Like |
| public default Future | Returns: a future completed with the listen operation resultthe port to listen on port)Like |
| public default HttpServer | listen(int
the port to listen on port, Handler<AsyncResult<HttpServer>> the listen handler listenHandler)Like |
| public default HttpServer | listen(Handler<AsyncResult<HttpServer>>
the listen handler listenHandler)Like |
| public HttpServer | Returns: a reference to this, so the API can be used fluentlySet the request handler for the server to |
| public Handler | |
| public ReadStream | Returns: the request stream
Deprecated
instead use
requestHandler(Handler)
Return the request stream for the server. |
| public default Future | Returns: a future signaling the update successthe new SSL options options)Update the server with new SSL |
| public default void | updateSSLOptions(SSLOptions
the new SSL options options, Handler<AsyncResult<Boolean>> the update handler handler)Like |
| public Future | Returns: a future signaling the update successthe new SSL options options, boolean force the update when options are equals force)Update the server with new SSL |
| public default void | updateSSLOptions(SSLOptions
the new SSL options options, boolean force the update when options are equals force, Handler<AsyncResult<Boolean>> the update handler handler)Like |
| public void | updateTrafficShapingOptions(TrafficShapingOptions
the new traffic shaping options options)Update traffic shaping options |
| public HttpServer | Returns: a reference to this, so the API can be used fluentlySet the WebSocket handler for the server to |
| public Handler | |
| public HttpServer | webSocketHandshakeHandler(Handler<ServerWebSocketHandshake> handler)
Set a handler for WebSocket handshake. |
| public ReadStream | Returns: the WebSocket stream
Deprecated
instead use
webSocketHandler(Handler)
Return the WebSocket stream for the server. |
| actualPort | back to summary |
|---|---|
| public int actualPort() The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number signifying an ephemeral port
| |
| close | back to summary |
|---|---|
| public Future Close the server. Any open HTTP connections will be closed. The close happens asynchronously and the server may not be closed until some time after the call has returned. | |
| close | back to summary |
|---|---|
| public void close(Handler<AsyncResult<Void>> completionHandler) Like
| |
| connectionHandler | back to summary |
|---|---|
| public HttpServer connectionHandler(Handler<HttpConnection> handler) Set a connection handler for the server.
| |
| exceptionHandler | back to summary |
|---|---|
| public 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.
| |
| invalidRequestHandler | back to summary |
|---|---|
| public HttpServer invalidRequestHandler(Handler<HttpServerRequest> handler) Set a Currently this handler is only used for HTTP/1.x requests. When no specific handler is set, the
| |
| listen | back to summary |
|---|---|
| public Future Tell the server to start listening. The server will listen on the port and host specified in the
The listen happens asynchronously and the server may not be listening until some time after the call has returned.
| |
| listen | back to summary |
|---|---|
| public default Future Tell the server to start listening. The server will listen on the port and host specified here,
ignoring any value set in the The listen happens asynchronously and the server may not be listening until some time after the call has returned.
| |
| listen | back to summary |
|---|---|
| public default HttpServer listen(int port, String host, Handler<AsyncResult<HttpServer>> listenHandler) Like
| |
| listen | back to summary |
|---|---|
| public default 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).
| |
| listen | back to summary |
|---|---|
| public Future Like | |
| listen | back to summary |
|---|---|
| public default Future Like
| |
| listen | back to summary |
|---|---|
| public default HttpServer listen(int port, Handler<AsyncResult<HttpServer>> listenHandler) Like
| |
| listen | back to summary |
|---|---|
| public default HttpServer listen(Handler<AsyncResult<HttpServer>> listenHandler) Like
| |
| requestHandler | back to summary |
|---|---|
| public HttpServer requestHandler(Handler<HttpServerRequest> handler) Set the request handler for the server to
| |
| requestHandler | back to summary |
|---|---|
public Handler
| |
| requestStream | back to summary |
|---|---|
| public ReadStream Deprecated instead use Return the request stream for the server. As HTTP requests are received by the server,
instances of
| |
| updateSSLOptions | back to summary |
|---|---|
| public default Future Update the server with new SSL The boolean succeeded future result indicates whether the update occurred.
| |
| updateSSLOptions | back to summary |
|---|---|
| public default void updateSSLOptions(SSLOptions options, Handler<AsyncResult<Boolean>> handler) Like
| |
| updateSSLOptions | back to summary |
|---|---|
| public Future Update the server with new SSL The The boolean succeeded future result indicates whether the update occurred.
| |
| updateSSLOptions | back to summary |
|---|---|
| public default void updateSSLOptions(SSLOptions options, boolean force, Handler<AsyncResult<Boolean>> handler) Like
| |
| updateTrafficShapingOptions | back to summary |
|---|---|
| public void updateTrafficShapingOptions(TrafficShapingOptions options) Update traffic shaping options
| |
| webSocketHandler | back to summary |
|---|---|
| public HttpServer webSocketHandler(Handler<ServerWebSocket> handler) Set the WebSocket handler for the server to
| |
| webSocketHandler | back to summary |
|---|---|
public Handler
| |
| webSocketHandshakeHandler | back to summary |
|---|---|
| public HttpServer webSocketHandshakeHandler(Handler<ServerWebSocketHandshake> handler) Set a handler for WebSocket handshake. When an inbound HTTP request presents a WebSocket upgrade, this handler is called first. The handler
can chose to Setting no handler, implicitly accepts any HTTP request connection presenting an upgrade header and upgrades it to a WebSocket.
| |
| webSocketStream | back to summary |
|---|---|
| public ReadStream Deprecated instead use Return the WebSocket stream for the server. If a WebSocket connect handshake is successful a
new
| |