Interface Server


  • public interface Server
    An HTTP server providing transport for Exonum transactions and read-requests.
    • Method Summary

      Modifier and Type Method Description
      static Server create()
      Creates an HTTP server with no request handlers.
      io.vertx.ext.web.Router createRouter()
      Creates a request router.
      void mountSubRouter​(String mountPoint, io.vertx.ext.web.Router subRouter)
      Mounts the sub router on the root router of this server.
      void start​(int port)
      Starts listening on the given TCP port.
      CompletableFuture<Void> stop()
      Requests the server to stop listening to incoming requests and release any resources.
    • Method Detail

      • create

        static Server create()
        Creates an HTTP server with no request handlers.

        Use start(int) to start listening to incoming requests.

      • createRouter

        io.vertx.ext.web.Router createRouter()
        Creates a request router. The router is empty: it has no routes to request handlers set up.
        Returns:
        a new request router
      • mountSubRouter

        void mountSubRouter​(String mountPoint,
                            io.vertx.ext.web.Router subRouter)
        Mounts the sub router on the root router of this server. You can do that before or after the server has started.

        Please note that the prefix is stripped from the path when request is forwarded to the sub-router. For example, to handle requests to '/cryptocurrency/send-money' and '/cryptocurrency/balance', use prefix '/cryptocurrency' and a router forwarding requests to '/send-money' and '/balance' to the appropriate handlers.

        Parameters:
        mountPoint - a mount point (a path prefix) to mount it on
        subRouter - a router responsible for handling requests that have the given path prefix
      • start

        void start​(int port)
        Starts listening on the given TCP port.
        Parameters:
        port - a port to listen on
      • stop

        CompletableFuture<Void> stop()
        Requests the server to stop listening to incoming requests and release any resources. Blocking handlers processing requests will be interrupted.

        Subsequent invocations have no effect. Once stopped, the server cannot be restarted. Please create a new server.

        Returns:
        a future that is completed when the server is stopped