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)
HttpServer
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 Handler<HttpServerRequest> requestHandler()
HttpServer
requestHandler
in interface HttpServer
public HttpServer websocketHandler(Handler<ServerWebSocket> wsHandler)
HttpServer
wsHandler
. If a websocket connect handshake is successful a
new WebSocket
instance will be created and passed to the handler.websocketHandler
in interface HttpServer
public Handler<ServerWebSocket> websocketHandler()
HttpServer
websocketHandler
in interface HttpServer
public HttpServer listen(int port)
HttpServer
port
listen
in interface HttpServer
public HttpServer listen(int port, java.lang.String host)
HttpServer
port
and hostname or ip address given by host
.listen
in interface HttpServer
public void close()
HttpServer
close
in interface HttpServer
public void close(Handler<java.lang.Void> done)
HttpServer
doneHandler
will be called when the close
is complete.close
in interface HttpServer
public HttpServer setSSL(boolean ssl)
HttpServer
ssl
is true
, this signifies that any connections will be SSL connections.setSSL
in interface HttpServer
public HttpServer setKeyStorePath(java.lang.String path)
HttpServer
HttpServer.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 HttpServer
public HttpServer setKeyStorePassword(java.lang.String pwd)
HttpServer
HttpServer.setSSL(boolean)
has been set to true
.setKeyStorePassword
in interface HttpServer
public HttpServer setTrustStorePath(java.lang.String path)
HttpServer
HttpServer.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 HttpServer
public HttpServer setTrustStorePassword(java.lang.String pwd)
HttpServer
HttpServer.setSSL(boolean)
has been set to true
.setTrustStorePassword
in interface HttpServer
public HttpServer setClientAuthRequired(boolean required)
HttpServer
required
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 HttpServer
public HttpServer setTCPNoDelay(boolean tcpNoDelay)
HttpServer
tcpNoDelay
is set to true
then Nagle's algorithm
will turned off for the TCP connections created by this instance.setTCPNoDelay
in interface HttpServer
public HttpServer setSendBufferSize(int size)
HttpServer
size
in bytes.setSendBufferSize
in interface HttpServer
public HttpServer setReceiveBufferSize(int size)
HttpServer
size
in bytes.setReceiveBufferSize
in interface HttpServer
public HttpServer setTCPKeepAlive(boolean keepAlive)
HttpServer
keepAlive
.setTCPKeepAlive
in interface HttpServer
public HttpServer setReuseAddress(boolean reuse)
HttpServer
reuse
.setReuseAddress
in interface HttpServer
public HttpServer setSoLinger(boolean linger)
HttpServer
linger
.setSoLinger
in interface HttpServer
public HttpServer setTrafficClass(int trafficClass)
HttpServer
trafficClass
.setTrafficClass
in interface HttpServer
public HttpServer setAcceptBacklog(int backlog)
HttpServer
setAcceptBacklog
in interface HttpServer
public java.lang.Boolean isTCPNoDelay()
isTCPNoDelay
in interface HttpServer
public java.lang.Integer getSendBufferSize()
getSendBufferSize
in interface HttpServer
public java.lang.Integer getReceiveBufferSize()
getReceiveBufferSize
in interface HttpServer
public java.lang.Boolean isTCPKeepAlive()
isTCPKeepAlive
in interface HttpServer
public java.lang.Boolean isReuseAddress()
isReuseAddress
in interface HttpServer
public java.lang.Boolean isSoLinger()
isSoLinger
in interface HttpServer
public java.lang.Integer getTrafficClass()
getTrafficClass
in interface HttpServer
public java.lang.Integer getAcceptBacklog()
getAcceptBacklog
in interface HttpServer
public boolean isSSL()
isSSL
in interface HttpServer
public java.lang.String getKeyStorePath()
getKeyStorePath
in interface HttpServer
public java.lang.String getKeyStorePassword()
getKeyStorePassword
in interface HttpServer
public java.lang.String getTrustStorePath()
getTrustStorePath
in interface HttpServer
public java.lang.String getTrustStorePassword()
getTrustStorePassword
in interface HttpServer