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 Summary
FieldsFields inherited from class io.vertx.core.AbstractVerticle
context, vertx -
Constructor Summary
ConstructorsConstructorDescriptionVertxWebServer(KosContext kosContext) Constructs a VertxWebServer.VertxWebServer(KosContext kosContext, boolean autoConfigOptionals) Constructs VertxWebServer.VertxWebServer(KosContext kosContext, SimplifiedRouter router) Constructs a VertxWebServer. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterStart(io.vertx.core.http.HttpServer server) Executes as soon as the server is started.protected voidExecutes before the server is started.private static SimplifiedRouterloadDefaultRouter(KosContext kosContext, boolean autoConfigOptionals) private voidvoidstart()voidio.vertx.core.Future<io.vertx.core.http.HttpServer>Methods inherited from class io.vertx.core.AbstractVerticle
config, deploymentID, getVertx, init, processArgs, stop, stop
-
Field Details
-
kosContext
-
router
-
-
Constructor Details
-
VertxWebServer
Constructs a VertxWebServer. This constructor will automatically run and configure all option flags.- Parameters:
kosContext- Kos Configuration
-
VertxWebServer
Constructs VertxWebServer.- Parameters:
kosContext- - Kos ConfigurationautoConfigOptionals- - true if should automatically config all optionals
-
VertxWebServer
Constructs a VertxWebServer.- Parameters:
kosContext- a valid configurationrouter- a pre-configured Simplified Router.
-
-
Method Details
-
loadDefaultRouter
private static SimplifiedRouter loadDefaultRouter(KosContext kosContext, boolean autoConfigOptionals) -
start
public void start()- Overrides:
startin classio.vertx.core.AbstractVerticle
-
start
- Specified by:
startin interfaceio.vertx.core.Verticle- Overrides:
startin classio.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.
-