private String indexPage;
public void start() {
super.start();
HttpServer server = vertx.createHttpServer();
if (getOptionalBooleanConfig("ssl", false)) {
server.setSSL(true).setKeyStorePassword(getOptionalStringConfig("key_store_password", "wibble"))
.setKeyStorePath(getOptionalStringConfig("key_store_path", "server-keystore.jks"));
}
if (getOptionalBooleanConfig("static_files", true)) {
server.requestHandler(this);
}
boolean bridge = getOptionalBooleanConfig("bridge", false);
if (bridge) {
SockJSServer sjsServer = vertx.createSockJSServer(server);
JsonArray inboundPermitted = getOptionalArrayConfig("inbound_permitted", new JsonArray());
JsonArray outboundPermitted = getOptionalArrayConfig("outbound_permitted", new JsonArray());
sjsServer.bridge(getOptionalObjectConfig("sjs_config", new JsonObject().putString("prefix", "/eventbus")),
inboundPermitted, outboundPermitted,
getOptionalLongConfig("auth_timeout", 5 * 60 * 1000),
getOptionalStringConfig("auth_address", "vertx.basicauthmanager.authorise"));
}
String webRoot = getOptionalStringConfig("web_root", "web");
String index = getOptionalStringConfig("index_page", "index.html");
webRootPrefix = webRoot + File.separator;
indexPage = webRootPrefix + index;
server.listen(getOptionalIntConfig("port", 80), getOptionalStringConfig("host", "0.0.0.0"));
}