io.vertx.rxjava.core.http

## Class HttpServer

- java.lang.Object
- - io.vertx.rxjava.core.http.HttpServer

- All Implemented Interfaces:
    Measured

      public class HttpServer
      extends Object
      implements Measured

  An HTTP and WebSockets server.

  You receive HTTP requests by providing a `requestHandler(io.vertx.core.Handler<io.vertx.rxjava.core.http.HttpServerRequest>)`. As requests arrive on the server the handler will be called with the requests.

  You receive WebSockets by providing a `webSocketHandler(io.vertx.core.Handler<io.vertx.rxjava.core.http.ServerWebSocket>)`. As WebSocket connections arrive on the server, the WebSocket is passed to the handler.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<HttpServer>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpServer(HttpServer delegate)`
    `HttpServer(Object delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `actualPort()` The actual port the server is listening on.
    `void` | `close()` Close the server.
    `void` | `close(Handler<AsyncResult<Void>> completionHandler)` Like `close()` but supplying a handler that will be called when the server is actually closed (or has failed).
    `Observable<Void>` | `closeObservable()` Deprecated. use `rxClose()` instead
    `HttpServer` | `connectionHandler(Handler<HttpConnection> handler)` Set a connection handler for the server.
    `boolean` | `equals(Object o)`
    `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.
    `HttpServer` | `getDelegate()`
    `int` | `hashCode()`
    `boolean` | `isMetricsEnabled()` Whether the metrics are enabled for this measured object
    `HttpServer` | `listen()` Tell the server to start listening.
    `HttpServer` | `listen(Handler<AsyncResult<HttpServer>> listenHandler)` Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
    `HttpServer` | `listen(int port)` Like `listen()` but the server will listen on host "0.0.0.0" and port specified here ignoring any value in the `HttpServerOptions` that was used when creating the server.
    `HttpServer` | `listen(int port, Handler<AsyncResult<HttpServer>> listenHandler)` Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
    `HttpServer` | `listen(int port, String host)` Tell the server to start listening.
    `HttpServer` | `listen(int port, String host, Handler<AsyncResult<HttpServer>> listenHandler)` Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
    `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).
    `Observable<HttpServer>` | `listenObservable()` Deprecated. use `rxListen(int, java.lang.String)` instead
    `Observable<HttpServer>` | `listenObservable(int port)` Deprecated. use `rxListen(int, java.lang.String)` instead
    `Observable<HttpServer>` | `listenObservable(int port, String host)` Deprecated. use `rxListen(int, java.lang.String)` instead
    `Observable<HttpServer>` | `listenObservable(SocketAddress address)` Deprecated. use `rxListen(int, java.lang.String)` instead
    `static HttpServer` | `newInstance(HttpServer arg)`
    `HttpServer` | `requestHandler(Handler<HttpServerRequest> handler)` Set the request handler for the server to `requestHandler`.
    `ReadStream<HttpServerRequest>` | `requestStream()` Return the request stream for the server.
    `Single<Void>` | `rxClose()` Like `close()` but supplying a handler that will be called when the server is actually closed (or has failed).
    `Single<HttpServer>` | `rxListen()` Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
    `Single<HttpServer>` | `rxListen(int port)` Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
    `Single<HttpServer>` | `rxListen(int port, String host)` Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
    `Single<HttpServer>` | `rxListen(SocketAddress address)` 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).
    `String` | `toString()`
    `HttpServer` | `websocketHandler(Handler<ServerWebSocket> handler)` Deprecated.
    `HttpServer` | `webSocketHandler(Handler<ServerWebSocket> handler)` Set the WebSocket handler for the server to `wsHandler`.
    `ReadStream<ServerWebSocket>` | `websocketStream()` Deprecated.
    `ReadStream<ServerWebSocket>` | `webSocketStream()` Return the WebSocket stream for the server.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.rxjava.core.metrics.Measured

      `newInstance`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<HttpServer> __TYPE_ARG

  - ### Constructor Detail

    - #### HttpServer

          public HttpServer(HttpServer delegate)

    - #### HttpServer

          public HttpServer(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public HttpServer getDelegate()

      Specified by:
        `getDelegate` in interface `Measured`

    - #### isMetricsEnabled

          public boolean isMetricsEnabled()

      Whether the metrics are enabled for this measured object
      Specified by:
        `isMetricsEnabled` in interface `Measured`
      Returns:
        `true` if metrics are enabled

    - #### requestStream

          public ReadStream<HttpServerRequest> requestStream()

      Return the request stream for the server. As HTTP requests are received by the server, instances of `HttpServerRequest` will be created and passed to the stream .
      Returns:
        the request stream

    - #### requestHandler

          public HttpServer requestHandler(Handler<HttpServerRequest> handler)

      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.
      Parameters:
        `handler` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### connectionHandler

          public HttpServer connectionHandler(Handler<HttpConnection> handler)

      Set a connection handler for the server.
      Parameters:
        `handler` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### exceptionHandler

          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.
      Parameters:
        `handler` - the handler to set
      Returns:
        a reference to this, so the API can be used fluently

    - #### websocketStream

          @Deprecated
          public ReadStream<ServerWebSocket> websocketStream()

      Deprecated.
      Return the WebSocket stream for the server. If a webSocket connect handshake is successful a new `ServerWebSocket` instance will be created and passed to the stream .
      Returns:
        the WebSocket stream

    - #### webSocketStream

          public ReadStream<ServerWebSocket> webSocketStream()

      Return the WebSocket stream for the server. If a WebSocket connect handshake is successful a new `ServerWebSocket` instance will be created and passed to the stream .
      Returns:
        the WebSocket stream

    - #### websocketHandler

          @Deprecated
          public HttpServer websocketHandler(Handler<ServerWebSocket> handler)

      Deprecated.
      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.
      Parameters:
        `handler` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### webSocketHandler

          public HttpServer webSocketHandler(Handler<ServerWebSocket> handler)

      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.
      Parameters:
        `handler` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### listen

          public HttpServer listen()

      Tell the server to start listening. The server will listen on the port and host specified in the `HttpServerOptions` that was used when creating the server.

      The listen happens asynchronously and the server may not be listening until some time after the call has returned.

      Returns:
        a reference to this, so the API can be used fluently

    - #### listen

          public HttpServer listen(int port,
                                   String host)

      Tell the server to start listening. The server will listen on the port and host specified here, ignoring any value set in the `HttpServerOptions` that was used when creating the server.

      The listen happens asynchronously and the server may not be listening until some time after the call has returned.

      Parameters:
        `port` - the port to listen on
        `host` - the host to listen on
      Returns:
        a reference to this, so the API can be used fluently

    - #### listen

          public HttpServer listen(int port,
                                   String host,
                                   Handler<AsyncResult<HttpServer>> listenHandler)

      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Parameters:
        `port` - the port to listen on
        `host` - the host to listen on
        `listenHandler` - the listen handler
      Returns:

    - #### listenObservable

          @Deprecated
          public Observable<HttpServer> listenObservable(int port,
                                                                     String host)

      Deprecated. use `rxListen(int, java.lang.String)` instead
      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Parameters:
        `port` - the port to listen on
        `host` - the host to listen on
      Returns:

    - #### rxListen

          public Single<HttpServer> rxListen(int port,
                                             String host)

      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Parameters:
        `port` - the port to listen on
        `host` - the host to listen on
      Returns:

    - #### listen

          public 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).
      Parameters:
        `address` - the address to listen on
        `listenHandler` - the listen handler
      Returns:

    - #### listenObservable

          @Deprecated
          public Observable<HttpServer> listenObservable(SocketAddress address)

      Deprecated. use `rxListen(int, java.lang.String)` instead
      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).
      Parameters:
        `address` - the address to listen on
      Returns:

    - #### rxListen

          public Single<HttpServer> rxListen(SocketAddress address)

      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).
      Parameters:
        `address` - the address to listen on
      Returns:

    - #### listen

          public HttpServer listen(int port)

      Like `listen()` but the server will listen on host "0.0.0.0" and port specified here ignoring any value in the `HttpServerOptions` that was used when creating the server.
      Parameters:
        `port` - the port to listen on
      Returns:
        a reference to this, so the API can be used fluently

    - #### listen

          public HttpServer listen(int port,
                                   Handler<AsyncResult<HttpServer>> listenHandler)

      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Parameters:
        `port` - the port to listen on
        `listenHandler` - the listen handler
      Returns:

    - #### listenObservable

          @Deprecated
          public Observable<HttpServer> listenObservable(int port)

      Deprecated. use `rxListen(int, java.lang.String)` instead
      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Parameters:
        `port` - the port to listen on
      Returns:

    - #### rxListen

          public Single<HttpServer> rxListen(int port)

      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Parameters:
        `port` - the port to listen on
      Returns:

    - #### listen

          public HttpServer listen(Handler<AsyncResult<HttpServer>> listenHandler)

      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Parameters:
        `listenHandler` - the listen handler
      Returns:

    - #### listenObservable

          @Deprecated
          public Observable<HttpServer> listenObservable()

      Deprecated. use `rxListen(int, java.lang.String)` instead
      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Returns:

    - #### rxListen

          public Single<HttpServer> rxListen()

      Like `listen()` but supplying a handler that will be called when the server is actually listening (or has failed).
      Returns:

    - #### close

          public void close()

      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

          public void close(Handler<AsyncResult<Void>> completionHandler)

      Like `close()` but supplying a handler that will be called when the server is actually closed (or has failed).
      Parameters:
        `completionHandler` - the handler

    - #### closeObservable

          @Deprecated
          public Observable<Void> closeObservable()

      Deprecated. use `rxClose()` instead
      Like `close()` but supplying a handler that will be called when the server is actually closed (or has failed).
      Returns:

    - #### rxClose

          public Single<Void> rxClose()

      Like `close()` but supplying a handler that will be called when the server is actually closed (or has failed).
      Returns:

    - #### actualPort

          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
      Returns:
        the actual port the server is listening on.

    - #### newInstance

          public static HttpServer newInstance(HttpServer arg)

Copyright © 2020 Eclipse. All rights reserved.