public class DefaultHttpServer extends java.lang.Object implements HttpServer
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultHttpServer.ServerHandler |
| Constructor and Description |
|---|
DefaultHttpServer(VertxInternal vertx) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the server.
|
void |
close(Handler<java.lang.Void> done)
Close the server.
|
java.lang.Integer |
getAcceptBacklog() |
java.lang.String |
getKeyStorePassword() |
java.lang.String |
getKeyStorePath() |
java.lang.Integer |
getReceiveBufferSize() |
java.lang.Integer |
getSendBufferSize() |
java.lang.Integer |
getTrafficClass() |
java.lang.String |
getTrustStorePassword() |
java.lang.String |
getTrustStorePath() |
java.lang.Boolean |
isReuseAddress() |
java.lang.Boolean |
isSoLinger() |
boolean |
isSSL() |
java.lang.Boolean |
isTCPKeepAlive() |
java.lang.Boolean |
isTCPNoDelay() |
HttpServer |
listen(int port)
Tell the server to start listening on all available interfaces and port
port |
HttpServer |
listen(int port,
java.lang.String host)
Tell the server to start listening on port
port and hostname or ip address given by host. |
Handler<HttpServerRequest> |
requestHandler()
Get the request handler
|
HttpServer |
requestHandler(Handler<HttpServerRequest> requestHandler)
Set the request handler for the server to
requestHandler. |
HttpServer |
setAcceptBacklog(int backlog)
Set the accept backlog
|
HttpServer |
setClientAuthRequired(boolean required)
Set
required to true if you want the server to request client authentication from any connecting clients. |
HttpServer |
setKeyStorePassword(java.lang.String pwd)
Set the password for the SSL key store.
|
HttpServer |
setKeyStorePath(java.lang.String path)
Set the path to the SSL key store.
|
HttpServer |
setReceiveBufferSize(int size)
Set the TCP receive buffer size for connections created by this instance to
size in bytes. |
HttpServer |
setReuseAddress(boolean reuse)
Set the TCP reuseAddress setting for connections created by this instance to
reuse. |
HttpServer |
setSendBufferSize(int size)
Set the TCP send buffer size for connections created by this instance to
size in bytes. |
HttpServer |
setSoLinger(boolean linger)
Set the TCP soLinger setting for connections created by this instance to
linger. |
HttpServer |
setSSL(boolean ssl)
If
ssl is true, this signifies that any connections will be SSL connections. |
HttpServer |
setTCPKeepAlive(boolean keepAlive)
Set the TCP keepAlive setting for connections created by this instance to
keepAlive. |
HttpServer |
setTCPNoDelay(boolean tcpNoDelay)
If
tcpNoDelay is set to true then Nagle's algorithm
will turned off for the TCP connections created by this instance. |
HttpServer |
setTrafficClass(int trafficClass)
Set the TCP trafficClass setting for connections created by this instance to
trafficClass. |
HttpServer |
setTrustStorePassword(java.lang.String pwd)
Set the password for the SSL trust store.
|
HttpServer |
setTrustStorePath(java.lang.String path)
Set the path to the SSL trust store.
|
Handler<ServerWebSocket> |
websocketHandler()
Get the websocket handler
|
HttpServer |
websocketHandler(Handler<ServerWebSocket> wsHandler)
Set the websocket handler for the server to
wsHandler. |
public DefaultHttpServer(VertxInternal vertx)
public HttpServer requestHandler(Handler<HttpServerRequest> requestHandler)
HttpServerrequestHandler. As HTTP requests are received by the server,
instances of HttpServerRequest will be created and passed to this handler.requestHandler in interface HttpServerpublic Handler<HttpServerRequest> requestHandler()
HttpServerrequestHandler in interface HttpServerpublic HttpServer websocketHandler(Handler<ServerWebSocket> wsHandler)
HttpServerwsHandler. If a websocket connect handshake is successful a
new WebSocket instance will be created and passed to the handler.websocketHandler in interface HttpServerpublic Handler<ServerWebSocket> websocketHandler()
HttpServerwebsocketHandler in interface HttpServerpublic HttpServer listen(int port)
HttpServerportlisten in interface HttpServerpublic HttpServer listen(int port, java.lang.String host)
HttpServerport and hostname or ip address given by host.listen in interface HttpServerpublic void close()
HttpServerclose in interface HttpServerpublic void close(Handler<java.lang.Void> done)
HttpServerdoneHandler will be called when the close
is complete.close in interface HttpServerpublic HttpServer setSSL(boolean ssl)
HttpServerssl is true, this signifies that any connections will be SSL connections.setSSL in interface HttpServerpublic HttpServer setKeyStorePath(java.lang.String path)
HttpServerHttpServer.setSSL(boolean)
has been set to true.The SSL key store is a standard Java Key Store, and should contain the server certificate.
setKeyStorePath in interface HttpServerpublic HttpServer setKeyStorePassword(java.lang.String pwd)
HttpServerHttpServer.setSSL(boolean)
has been set to true.setKeyStorePassword in interface HttpServerpublic HttpServer setTrustStorePath(java.lang.String path)
HttpServerHttpServer.setSSL(boolean)
has been set to true.The trust store is a standard Java Key Store, and should contain the certificates of any clients that the server trusts - this is only necessary if client authentication is enabled.
setTrustStorePath in interface HttpServerpublic HttpServer setTrustStorePassword(java.lang.String pwd)
HttpServerHttpServer.setSSL(boolean)
has been set to true.setTrustStorePassword in interface HttpServerpublic HttpServer setClientAuthRequired(boolean required)
HttpServerrequired to true if you want the server to request client authentication from any connecting clients. This
is an extra level of security in SSL, and requires clients to provide client certificates. Those certificates must be added
to the server trust store.setClientAuthRequired in interface HttpServerpublic HttpServer setTCPNoDelay(boolean tcpNoDelay)
HttpServertcpNoDelay is set to true then Nagle's algorithm
will turned off for the TCP connections created by this instance.setTCPNoDelay in interface HttpServerpublic HttpServer setSendBufferSize(int size)
HttpServersize in bytes.setSendBufferSize in interface HttpServerpublic HttpServer setReceiveBufferSize(int size)
HttpServersize in bytes.setReceiveBufferSize in interface HttpServerpublic HttpServer setTCPKeepAlive(boolean keepAlive)
HttpServerkeepAlive.setTCPKeepAlive in interface HttpServerpublic HttpServer setReuseAddress(boolean reuse)
HttpServerreuse.setReuseAddress in interface HttpServerpublic HttpServer setSoLinger(boolean linger)
HttpServerlinger.setSoLinger in interface HttpServerpublic HttpServer setTrafficClass(int trafficClass)
HttpServertrafficClass.setTrafficClass in interface HttpServerpublic HttpServer setAcceptBacklog(int backlog)
HttpServersetAcceptBacklog in interface HttpServerpublic java.lang.Boolean isTCPNoDelay()
isTCPNoDelay in interface HttpServerpublic java.lang.Integer getSendBufferSize()
getSendBufferSize in interface HttpServerpublic java.lang.Integer getReceiveBufferSize()
getReceiveBufferSize in interface HttpServerpublic java.lang.Boolean isTCPKeepAlive()
isTCPKeepAlive in interface HttpServerpublic java.lang.Boolean isReuseAddress()
isReuseAddress in interface HttpServerpublic java.lang.Boolean isSoLinger()
isSoLinger in interface HttpServerpublic java.lang.Integer getTrafficClass()
getTrafficClass in interface HttpServerpublic java.lang.Integer getAcceptBacklog()
getAcceptBacklog in interface HttpServerpublic boolean isSSL()
isSSL in interface HttpServerpublic java.lang.String getKeyStorePath()
getKeyStorePath in interface HttpServerpublic java.lang.String getKeyStorePassword()
getKeyStorePassword in interface HttpServerpublic java.lang.String getTrustStorePath()
getTrustStorePath in interface HttpServerpublic java.lang.String getTrustStorePassword()
getTrustStorePassword in interface HttpServer