io.vertx.rxjava3.core.http

## Class HttpServer

- java.lang.Object
- - io.vertx.rxjava3.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.rxjava3.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.rxjava3.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.
    `Completable` | `close()` Like `close()` but supplying a handler that will be called when the server is actually closed (or has failed).
    `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()`
    `HttpServer` | `invalidRequestHandler(Handler<HttpServerRequest> handler)` Set a `handler` for handling invalid requests.
    `boolean` | `isMetricsEnabled()` Whether the metrics are enabled for this measured object
    `Single<HttpServer>` | `listen()` Like `listen(int, java.lang.String)` but supplying a handler that will be called when the server is actually listening (or has failed).
    `Single<HttpServer>` | `listen(int port)` Like `listen(int, java.lang.String)` but supplying a handler that will be called when the server is actually listening (or has failed).
    `Single<HttpServer>` | `listen(int port, String host)` Like `listen(int, java.lang.String)` but supplying a handler that will be called when the server is actually listening (or has failed).
    `Single<HttpServer>` | `listen(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).
    `static HttpServer` | `newInstance(HttpServer arg)`
    `HttpServer` | `requestHandler(Handler<HttpServerRequest> handler)` Set the request handler for the server to `requestHandler`.
    `ReadStream<HttpServerRequest>` | `requestStream()` Deprecated.
    `Completable` | `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(int, java.lang.String)` but supplying a handler that will be called when the server is actually listening (or has failed).
    `Single<HttpServer>` | `rxListen(int port)` Like `listen(int, java.lang.String)` 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(int, java.lang.String)` 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).
    `Single<Boolean>` | `rxUpdateSSLOptions(SSLOptions options)` Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
    `Single<Boolean>` | `rxUpdateSSLOptions(SSLOptions options, boolean force)` Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
    `String` | `toString()`
    `Single<Boolean>` | `updateSSLOptions(SSLOptions options)` Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
    `Single<Boolean>` | `updateSSLOptions(SSLOptions options, boolean force)` Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
    `HttpServer` | `webSocketHandler(Handler<ServerWebSocket> handler)` Set the WebSocket handler for the server to `wsHandler`.
    `ReadStream<ServerWebSocket>` | `webSocketStream()` Deprecated.

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

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

    - ### Methods inherited from interface io.vertx.rxjava3.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

          @Deprecated
          public ReadStream<HttpServerRequest> requestStream()

      Deprecated.
      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 `ReadStream.handler(io.vertx.core.Handler<T>)`.
      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

    - #### invalidRequestHandler

          public HttpServer invalidRequestHandler(Handler<HttpServerRequest> handler)

      Set a `handler` for handling invalid requests. When an invalid request is received by the server this handler will be called with the request. The handler can send any HTTP response, when the response ends, the server shall close the connection. `io.vertx.rxjava3.core.http.HttpServerRequest#decoderResult` can be used to obtain the Netty decoder result and the failure cause reported by the decoder.

      Currently this handler is only used for HTTP/1.x requests.

      When no specific handler is set, the `HttpServerRequest` is used.

      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.
      The handler will always be called on the event-loop thread.
      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 `ReadStream.handler(io.vertx.core.Handler<T>)`.
      Returns:
        the WebSocket stream

    - #### 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

    - #### updateSSLOptions

          public Single<Boolean> updateSSLOptions(SSLOptions options)

      Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
      Parameters:
        `options` - the new SSL options
      Returns:

    - #### rxUpdateSSLOptions

          public Single<Boolean> rxUpdateSSLOptions(SSLOptions options)

      Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
      Parameters:
        `options` - the new SSL options
      Returns:

    - #### updateSSLOptions

          public Single<Boolean> updateSSLOptions(SSLOptions options,
                                                  boolean force)

      Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:

    - #### rxUpdateSSLOptions

          public Single<Boolean> rxUpdateSSLOptions(SSLOptions options,
                                                    boolean force)

      Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:

    - #### listen

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

      Like `listen(int, java.lang.String)` 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(int, java.lang.String)` 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 Single<HttpServer> listen(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:

    - #### 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 Single<HttpServer> listen(int port)

      Like `listen(int, java.lang.String)` 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(int, java.lang.String)` 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 Single<HttpServer> listen()

      Like `listen(int, java.lang.String)` 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(int, java.lang.String)` but supplying a handler that will be called when the server is actually listening (or has failed).
      Returns:

    - #### close

          public Completable close()

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

    - #### rxClose

          public Completable 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 © 2024 Eclipse. All rights reserved.