org.vertx.java.core.http

## Interface HttpServer

    public interface HttpServer

An HTTP and WebSockets server

If an instance is instantiated from an event loop then the handlers of the instance will always be called on that same event loop. If an instance is instantiated from some other arbitrary Java thread then an event loop will be assigned to the instance and used when any of its handlers are called.

Instances cannot be used from worker verticles

### Method Summary

Methods
`void` `close()` Close the server.
`void` `close(Handler<java.lang.Void> doneHandler)` 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`.

### Method Detail

#### requestHandler

    HttpServer requestHandler(Handler<HttpServerRequest> requestHandler)

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.

Returns:
  a reference to this, so methods can be chained.

#### requestHandler

    Handler<HttpServerRequest> requestHandler()

Get the request handler

Returns:
  The request handler

#### websocketHandler

    HttpServer websocketHandler(Handler<ServerWebSocket> wsHandler)

Set the websocket handler for the server to `wsHandler`. If a websocket connect handshake is successful a new `WebSocket` instance will be created and passed to the handler.

Returns:
  a reference to this, so methods can be chained.

#### websocketHandler

    Handler<ServerWebSocket> websocketHandler()

Get the websocket handler

Returns:
  The websocket handler

#### listen

    HttpServer listen(int port)

Tell the server to start listening on all available interfaces and port `port`

Returns:
  a reference to this, so methods can be chained.

#### listen

    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`.

Returns:
  a reference to this, so methods can be chained.

#### close

    void close()

Close the server. Any open HTTP connections will be closed.

#### close

    void close(Handler<java.lang.Void> doneHandler)

Close the server. Any open HTTP connections will be closed. The `doneHandler` will be called when the close is complete.

#### setSSL

    HttpServer setSSL(boolean ssl)

If `ssl` is `true`, this signifies that any connections will be SSL connections.

Returns:
  A reference to this, so multiple invocations can be chained together.

#### setKeyStorePath

    HttpServer setKeyStorePath(java.lang.String path)

Set the path to the SSL key store. This method should only be used in SSL mode, i.e. after `setSSL(boolean)` has been set to `true`.

The SSL key store is a standard Java Key Store, and should contain the server certificate.

Returns:
  A reference to this, so multiple invocations can be chained together.

#### setKeyStorePassword

    HttpServer setKeyStorePassword(java.lang.String pwd)

Set the password for the SSL key store. This method should only be used in SSL mode, i.e. after `setSSL(boolean)` has been set to `true`.

Returns:
  A reference to this, so multiple invocations can be chained together.

#### setTrustStorePath

    HttpServer setTrustStorePath(java.lang.String path)

Set the path to the SSL trust store. This method should only be used in SSL mode, i.e. after `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.

Returns:
  A reference to this, so multiple invocations can be chained together.

#### setTrustStorePassword

    HttpServer setTrustStorePassword(java.lang.String pwd)

Set the password for the SSL trust store. This method should only be used in SSL mode, i.e. after `setSSL(boolean)` has been set to `true`.

Returns:
  A reference to this, so multiple invocations can be chained together.

#### setClientAuthRequired

    HttpServer setClientAuthRequired(boolean required)

Set `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.

Returns:
  A reference to this, so multiple invocations can be chained together.

#### setTCPNoDelay

    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.

Returns:
  a reference to this so multiple method calls can be chained together

#### setSendBufferSize

    HttpServer setSendBufferSize(int size)

Set the TCP send buffer size for connections created by this instance to `size` in bytes.

Returns:
  a reference to this so multiple method calls can be chained together

#### setReceiveBufferSize

    HttpServer setReceiveBufferSize(int size)

Set the TCP receive buffer size for connections created by this instance to `size` in bytes.

Returns:
  a reference to this so multiple method calls can be chained together

#### setTCPKeepAlive

    HttpServer setTCPKeepAlive(boolean keepAlive)

Set the TCP keepAlive setting for connections created by this instance to `keepAlive`.

Returns:
  a reference to this so multiple method calls can be chained together

#### setReuseAddress

    HttpServer setReuseAddress(boolean reuse)

Set the TCP reuseAddress setting for connections created by this instance to `reuse`.

Returns:
  a reference to this so multiple method calls can be chained together

#### setSoLinger

    HttpServer setSoLinger(boolean linger)

Set the TCP soLinger setting for connections created by this instance to `linger`.

Returns:
  a reference to this so multiple method calls can be chained together

#### setTrafficClass

    HttpServer setTrafficClass(int trafficClass)

Set the TCP trafficClass setting for connections created by this instance to `trafficClass`.

Returns:
  a reference to this so multiple method calls can be chained together

#### setAcceptBacklog

    HttpServer setAcceptBacklog(int backlog)

Set the accept backlog

Returns:
  a reference to this so multiple method calls can be chained together

#### isTCPNoDelay

    java.lang.Boolean isTCPNoDelay()

Returns:
  true if Nagle's algorithm is disabled.

#### getSendBufferSize

    java.lang.Integer getSendBufferSize()

Returns:
  The TCP send buffer size

#### getReceiveBufferSize

    java.lang.Integer getReceiveBufferSize()

Returns:
  The TCP receive buffer size

#### isTCPKeepAlive

    java.lang.Boolean isTCPKeepAlive()

Returns:
  true if TCP keep alive is enabled

#### isReuseAddress

    java.lang.Boolean isReuseAddress()

Returns:
  The value of TCP reuse address

#### isSoLinger

    java.lang.Boolean isSoLinger()

Returns:
  the value of TCP so linger

#### getTrafficClass

    java.lang.Integer getTrafficClass()

Returns:
  the value of TCP traffic class

#### getAcceptBacklog

    java.lang.Integer getAcceptBacklog()

Returns:
  the accept backlog

#### isSSL

    boolean isSSL()

Returns:
  true if this server will make SSL connections

#### getKeyStorePath

    java.lang.String getKeyStorePath()

Returns:
  The path to the key store

#### getKeyStorePassword

    java.lang.String getKeyStorePassword()

Returns:
  The keystore password

#### getTrustStorePath

    java.lang.String getTrustStorePath()

Returns:
  The trust store path

#### getTrustStorePassword

    java.lang.String getTrustStorePassword()

Returns:
  The trust store password