Package kos.core

Class VertxWebServer

java.lang.Object
io.vertx.core.AbstractVerticle
kos.core.VertxWebServer
All Implemented Interfaces:
io.vertx.core.Verticle

public class VertxWebServer extends io.vertx.core.AbstractVerticle
Abstracts the creation of a Vert.x web server, automating a few repetitive tasks, automatically loading routes if available, and avoiding common mistakes made during the application bootstrap. This class was either designed to be compatible with Vert.x Verticle mechanism or to be run as standalone Java application.
  • Field Details

  • Constructor Details

    • VertxWebServer

      public VertxWebServer(KosContext kosContext)
      Constructs a VertxWebServer. This constructor will automatically run and configure all option flags.
      Parameters:
      kosContext - Kos Configuration
    • VertxWebServer

      public VertxWebServer(KosContext kosContext, boolean autoConfigOptionals)
      Constructs VertxWebServer.
      Parameters:
      kosContext - - Kos Configuration
      autoConfigOptionals - - true if should automatically config all optionals
    • VertxWebServer

      public VertxWebServer(KosContext kosContext, SimplifiedRouter router)
      Constructs a VertxWebServer.
      Parameters:
      kosContext - a valid configuration
      router - a pre-configured Simplified Router.
  • Method Details

    • loadDefaultRouter

      private static SimplifiedRouter loadDefaultRouter(KosContext kosContext, boolean autoConfigOptionals)
    • start

      public void start()
      Overrides:
      start in class io.vertx.core.AbstractVerticle
    • start

      public void start(io.vertx.core.Promise<Void> startFuture)
      Specified by:
      start in interface io.vertx.core.Verticle
      Overrides:
      start in class io.vertx.core.AbstractVerticle
    • tryToStartServer

      public io.vertx.core.Future<io.vertx.core.http.HttpServer> tryToStartServer()
    • notifyWebServerDeploymentListeners

      private void notifyWebServerDeploymentListeners()
    • beforeStart

      protected void beforeStart()
      Executes before the server is started.
    • afterStart

      protected void afterStart(io.vertx.core.http.HttpServer server)
      Executes as soon as the server is started.
      Parameters:
      server - reference to instantiated (and started) server.