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.AbstractVerticleAbstracts 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 Summary
Fields Modifier and Type Field Description private KosContextkosContextprivate io.vertx.core.logging.Loggerlogprivate @NonNull SimplifiedRouterrouter
-
Constructor Summary
Constructors Constructor Description VertxWebServer(KosContext kosContext)Constructs a VertxWebServer.VertxWebServer(KosContext kosContext, boolean autoConfigOptionals)Constructs VertxWebServer.VertxWebServer(KosContext kosContext, SimplifiedRouter router)Constructs a VertxWebServer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterStart(io.vertx.core.http.HttpServer server)Executes as soon as the server is started.protected voidbeforeStart()Executes before the server is started.private static SimplifiedRouterloadDefaultRouter(KosContext kosContext, boolean autoConfigOptionals)private voidnotifyWebServerDeploymentListeners()voidstart()voidstart(io.vertx.core.Promise<Void> startFuture)private voidstartServer(io.vertx.core.Promise<Void> startFuture)-
Methods inherited from class io.vertx.core.AbstractVerticle
config, deploymentID, getVertx, init, processArgs, start, stop, stop
-
-
-
-
Field Detail
-
log
private final io.vertx.core.logging.Logger log
-
kosContext
private final KosContext kosContext
-
router
@NonNull private @NonNull SimplifiedRouter router
-
-
Constructor Detail
-
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 ConfigurationautoConfigOptionals- - true if should automatically config all optionals
-
VertxWebServer
public VertxWebServer(KosContext kosContext, SimplifiedRouter router)
Constructs a VertxWebServer.- Parameters:
kosContext- a valid configurationrouter- a pre-configured Simplified Router.
-
-
Method Detail
-
loadDefaultRouter
private static SimplifiedRouter loadDefaultRouter(KosContext kosContext, boolean autoConfigOptionals)
-
start
public void start()
- Overrides:
startin classio.vertx.core.AbstractVerticle
-
start
public void start(io.vertx.core.Promise<Void> startFuture)
-
startServer
private void startServer(io.vertx.core.Promise<Void> startFuture)
-
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.
-
-