Class HttpServer

    • Constructor Detail

      • HttpServer

        public HttpServer​(io.vertx.core.http.HttpServer delegate)
      • HttpServer

        public HttpServer​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.core.http.HttpServer getDelegate()
        Specified by:
        getDelegate in interface Measured
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isMetricsEnabled

        public boolean isMetricsEnabled()
        Specified by:
        isMetricsEnabled in interface Measured
        Returns:
        true if metrics are enabled
      • exceptionHandler

        public HttpServer exceptionHandler​(Consumer<Throwable> handler)
        Parameters:
        handler - the handler to set
        Returns:
      • listen

        public io.smallrye.mutiny.Uni<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).

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        port - the port to listen on
        host - the host to listen on
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • listenAndAwait

        public HttpServer listenAndAwait​(int port,
                                         String host)
        Blocking variant of listen(int,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        port - the port to listen on
        host - the host to listen on
        Returns:
        the HttpServer instance produced by the operation.
      • listenAndForget

        public HttpServer listenAndForget​(int port,
                                          String host)
        Variant of listen(int,String) that ignores the result of the operation.

        This method subscribes on the result of listen(int,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from listen(int,String) but you don't need to compose it with other operations.

        Parameters:
        port - the port to listen on
        host - the host to listen on
        Returns:
        the instance of HttpServer to chain method calls.
      • listen

        public io.smallrye.mutiny.Uni<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).

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        address - the address to listen on
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • listenAndAwait

        public HttpServer listenAndAwait​(SocketAddress address)
        Blocking variant of listen(io.vertx.mutiny.core.net.SocketAddress).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        address - the address to listen on
        Returns:
        the HttpServer instance produced by the operation.
      • listen

        public io.smallrye.mutiny.Uni<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).

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        port - the port to listen on
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • listenAndAwait

        public HttpServer listenAndAwait​(int port)
        Blocking variant of listen(int).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        port - the port to listen on
        Returns:
        the HttpServer instance produced by the operation.
      • listenAndForget

        public HttpServer listenAndForget​(int port)
        Variant of listen(int) that ignores the result of the operation.

        This method subscribes on the result of listen(int), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from listen(int) but you don't need to compose it with other operations.

        Parameters:
        port - the port to listen on
        Returns:
        the instance of HttpServer to chain method calls.
      • listen

        public io.smallrye.mutiny.Uni<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).

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • listenAndAwait

        public HttpServer listenAndAwait()
        Blocking variant of listen(int, java.lang.String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the HttpServer instance produced by the operation.
      • close

        public io.smallrye.mutiny.Uni<Void> close()
        Like close() but supplying a handler that will be called when the server is actually closed (or has failed).

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • closeAndAwait

        public Void closeAndAwait()
        Blocking variant of close().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Void instance produced by the operation.
      • closeAndForget

        public void closeAndForget()
        Variant of close() that ignores the result of the operation.

        This method subscribes on the result of close(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from close() but you don't need to compose it with other operations.

      • actualPort

        public int actualPort()
        Returns:
        the actual port the server is listening on.
      • newInstance

        public static HttpServer newInstance​(io.vertx.core.http.HttpServer arg)