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 static io.vertx.core.logging.Loggerlogprivate @NonNull SimplifiedRouterrouter
-
Constructor Summary
Constructors Constructor Description VertxWebServer()
-
Method Summary
All 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 io.vertx.core.http.HttpServerOptionscreateServerOptions()The default server configuration.protected io.vertx.core.http.HttpServerOptionsloadServerOptions()Loads theHttpServerOptionsfrom the Class Path.private voidnotifyWebServerDeploymentListeners(io.vertx.core.http.HttpServerOptions httpServerOptions)SimplifiedRouterrouter()Retrieves the current configured router.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 static final io.vertx.core.logging.Logger log
-
router
@NonNull private @NonNull SimplifiedRouter router
-
-
Method Detail
-
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)
-
loadServerOptions
protected io.vertx.core.http.HttpServerOptions loadServerOptions()
Loads theHttpServerOptionsfrom the Class Path. Developers are encouraged to override this method whenever needed.- Returns:
- the found or created HttpServerOptions object.
-
createServerOptions
private io.vertx.core.http.HttpServerOptions createServerOptions()
The default server configuration. It will be triggered when the auto-discovery mechanism failed to find one in the classpath.
-
notifyWebServerDeploymentListeners
private void notifyWebServerDeploymentListeners(io.vertx.core.http.HttpServerOptions httpServerOptions)
-
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.
-
router
public SimplifiedRouter router()
Retrieves the current configured router. If none is defined, it will lazily instantiate the defaultSimplifiedRouterconfiguration.
-
-