Java Code Examples for io.vertx.core.file.FileSystem#readFile()

The following examples show how to use io.vertx.core.file.FileSystem#readFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainApiVerticle.java    From openapi-generator with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("openapi.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());

            deployVerticles(startFuture);

            vertx.createHttpServer()
                .requestHandler(swaggerRouter::accept) 
                .listen(serverPort, h -> {
                    if (h.succeeded()) {
                        startFuture.complete();
                    } else {
                        startFuture.fail(h.cause());
                    }
                });
        } else {
        	startFuture.fail(readFile.cause());
        }
    });        		        
}
 
Example 2
Source File: MainApiVerticle.java    From swagger-aem with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("openapi.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());

            deployVerticles(startFuture);

            vertx.createHttpServer()
                .requestHandler(swaggerRouter::accept) 
                .listen(serverPort, h -> {
                    if (h.succeeded()) {
                        startFuture.complete();
                    } else {
                        startFuture.fail(h.cause());
                    }
                });
        } else {
        	startFuture.fail(readFile.cause());
        }
    });        		        
}
 
Example 3
Source File: MainApiVerticle.java    From vertx-swagger with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
	FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("swagger.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            SwaggerManager.getInstance().setSwagger(swagger);
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
        
            deployVerticles(startFuture);

            vertx.createHttpServer() 
                .requestHandler(swaggerRouter::accept) 
                .listen(config().getInteger("http.port", 8080));
            startFuture.complete();
        } else {
        	startFuture.fail(readFile.cause());
        }
    });        		        
}
 
Example 4
Source File: MainApiVerticle.java    From vertx-swagger with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
	FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("swagger.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            SwaggerManager.getInstance().setSwagger(swagger);
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
        
            deployVerticles(startFuture);

            vertx.createHttpServer() 
                .requestHandler(swaggerRouter::accept) 
                .listen(config().getInteger("http.port", 8080));
            startFuture.complete();
        } else {
        	startFuture.fail(readFile.cause());
        }
    });        		        
}
 
Example 5
Source File: MainApiVerticle.java    From vertx-swagger with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
	FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("swagger.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            SwaggerManager.getInstance().setSwagger(swagger);
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
        
            deployVerticles(startFuture);

            vertx.createHttpServer() 
                .requestHandler(swaggerRouter::accept) 
                .listen(config().getInteger("http.port", 8080));
            startFuture.complete();
        } else {
        	startFuture.fail(readFile.cause());
        }
    });        		        
}
 
Example 6
Source File: MainApiVerticle.java    From vertx-swagger with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
	FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("swagger.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            SwaggerManager.getInstance().setSwagger(swagger);
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
        
            deployVerticles(startFuture);

            vertx.createHttpServer() 
                .requestHandler(swaggerRouter::accept) 
                .listen(config().getInteger("http.port", 8080));
            startFuture.complete();
        } else {
        	startFuture.fail(readFile.cause());
        }
    });        		        
}
 
Example 7
Source File: MainApiVerticle.java    From swaggy-jenkins with MIT License 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("openapi.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());

            deployVerticles(startFuture);

            vertx.createHttpServer()
                .requestHandler(swaggerRouter::accept) 
                .listen(serverPort, h -> {
                    if (h.succeeded()) {
                        startFuture.complete();
                    } else {
                        startFuture.fail(h.cause());
                    }
                });
        } else {
        	startFuture.fail(readFile.cause());
        }
    });        		        
}
 
Example 8
Source File: VxApiUserAuthUtil.java    From VX-API-Gateway with MIT License 6 votes vote down vote up
/**
 * 验证用户是否正确,如果正确返回json格式的用户如果不存在返回null
 * 
 * @param suser
 *            用户名字
 * @param spass
 *            用户密码
 * @param vertx
 *            vertx
 * @param handler
 *            结果
 */
public static void auth(String suser, String spass, Vertx vertx, Handler<AsyncResult<JsonObject>> handler) {
	FileSystem file = vertx.fileSystem();
	String path = PathUtil.getPathString("user.json");
	file.readFile(path, res -> {
		if (res.succeeded()) {
			JsonObject users = res.result().toJsonObject();
			if (users.getValue(suser) instanceof JsonObject) {
				JsonObject user = users.getJsonObject(suser);
				if (spass.equals(user.getString("pwd"))) {
					handler.handle(Future.<JsonObject>succeededFuture(user));
				} else {
					handler.handle(Future.<JsonObject>succeededFuture(null));
				}
			} else {
				handler.handle(Future.<JsonObject>succeededFuture(null));
			}
		} else {
			handler.handle(Future.failedFuture(res.cause()));
		}
	});
}
 
Example 9
Source File: HttpVerticle.java    From reactive-refarch-cloudformation with Apache License 2.0 6 votes vote down vote up
private void fillCacheWithData(final RoutingContext routingContext) {
    LOGGER.info("Filling caches with data ... ");
    LOGGER.debug("Reading JSON-data");

    FileSystem fs = vertx.fileSystem();
    fs.readFile("META-INF/data.json", res -> {
       if (res.succeeded()) {
            Buffer buf = res.result();
            JsonArray jsonArray = buf.toJsonArray();
           for (Object aJsonArray : jsonArray) {
               JsonObject obj = (JsonObject) aJsonArray;
               LOGGER.debug("Sending message to cache-verticles: " + obj);
               eb.send(Constants.CACHE_STORE_EVENTBUS_ADDRESS, obj);
               eb.send(Constants.REDIS_STORE_EVENTBUS_ADDRESS, obj);
           }
       } else {
           LOGGER.info(res.cause());
       }

        HttpServerResponse response = routingContext.request().response();
        response.putHeader("content-type", "application/json");
        response.end();
    });
}
 
Example 10
Source File: MainApiVerticle.java    From openapi-generator with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("openapi.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());

            deployVerticles(startFuture);

            vertx.createHttpServer()
                .requestHandler(swaggerRouter::accept) 
                .listen(serverPort, h -> {
                    if (h.succeeded()) {
                        startFuture.complete();
                    } else {
                        startFuture.fail(h.cause());
                    }
                });
        } else {
        	startFuture.fail(readFile.cause());
        }
    });        		        
}
 
Example 11
Source File: FormParameterExtractorTest.java    From vertx-swagger with Apache License 2.0 5 votes vote down vote up
@Test()
public void testOkFormDataSimpleFile(TestContext context) {
    Async async = context.async();
    HttpClientRequest req = httpClient.post(TEST_PORT, TEST_HOST, "/formdata/simple/file");
    req.handler(response -> {
        response.bodyHandler(body -> {
            context.assertEquals(response.statusCode(), 200);
            context.assertEquals("{\"test\":\"This is a test file.\"}", body.toString());
            async.complete();
        });
    });
    // Construct multipart data
    req.putHeader(HttpHeaders.CONTENT_TYPE, "multipart/form-data; boundary=MyBoundary");
    Buffer buffer = Buffer.factory.buffer();
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile(TEST_FILENAME, readFile -> {
        if (readFile.succeeded()) {
            buffer.appendString("\r\n");
            buffer.appendString("--MyBoundary\r\n");
            buffer.appendString("Content-Disposition: form-data; name=\"formDataRequired\"; filename=\"" + TEST_FILENAME + "\"\r\n");
            buffer.appendString("Content-Type: text/plain\r\n");
            buffer.appendString("\r\n");
            buffer.appendString(readFile.result().toString(Charset.forName("utf-8")));
            buffer.appendString("\r\n");
            buffer.appendString("--MyBoundary--");
            req.end(buffer);
        } else {
            context.fail(readFile.cause());
        }
    });
}
 
Example 12
Source File: VxApiClientJsonAuth.java    From VX-API-Gateway with MIT License 5 votes vote down vote up
/**
 * 验证用户是否有权限
 * 
 * @param user
 * @param vertx
 * @param handler
 */
public static void auth(JsonObject authInfo, Vertx vertx, Handler<AsyncResult<Boolean>> handler) {
	String username = authInfo.getString(VxApiRolesConstant.USER_NAME_KEY);
	if (username == null) {
		handler.handle(Future.succeededFuture(false));
	} else {
		String pwd = authInfo.getString(VxApiRolesConstant.USER_PWD_KEY);
		String role = authInfo.getString(VxApiRolesConstant.USER_ROLE_KEY);
		FileSystem file = vertx.fileSystem();
		String path = PathUtil.getPathString("user.json");
		file.readFile(path, res -> {
			if (res.succeeded()) {
				JsonObject users = res.result().toJsonObject();
				if (users.getValue(username) instanceof JsonObject) {
					JsonObject user = users.getJsonObject(username);
					if (pwd != null && pwd.equals(user.getString("pwd"))
							&& user.getJsonArray("roles").contains(role)) {
						handler.handle(Future.<Boolean>succeededFuture(true));
					} else {
						handler.handle(Future.<Boolean>succeededFuture(false));
					}
				} else {
					handler.handle(Future.<Boolean>succeededFuture(false));
				}
			} else {
				handler.handle(Future.failedFuture(res.cause()));
			}
		});
	}
}
 
Example 13
Source File: HttpBridge.java    From strimzi-kafka-bridge with Apache License 2.0 5 votes vote down vote up
private void openapi(RoutingContext routingContext) {
    FileSystem fileSystem = vertx.fileSystem();
    fileSystem.readFile("openapiv2.json", readFile -> {
        if (readFile.succeeded()) {
            HttpUtils.sendFile(routingContext, HttpResponseStatus.OK.code(), BridgeContentType.JSON, "openapiv2.json");
        } else {
            HttpBridgeError error = new HttpBridgeError(
                HttpResponseStatus.INTERNAL_SERVER_ERROR.code(),
                readFile.cause().getMessage());
            HttpUtils.sendResponse(routingContext, HttpResponseStatus.INTERNAL_SERVER_ERROR.code(),
                    BridgeContentType.JSON, error.toJson().toBuffer());
        }
    });
}
 
Example 14
Source File: ErrorHandlingTest.java    From vertx-swagger with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass(TestContext context) {
    Async before = context.async();
    vertx = Vertx.vertx();
    eventBus = vertx.eventBus();

    // init Router
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("swagger.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, eventBus);
            httpServer = vertx.createHttpServer().requestHandler(swaggerRouter::accept).listen(TEST_PORT, TEST_HOST, listen -> {
                if (listen.succeeded()) {
                    before.complete();
                } else {
                    context.fail(listen.cause());
                }
            });
        } else {
            context.fail(readFile.cause());
        }
    });

    // init consumers
    eventBus.<JsonObject> consumer("GET_store_inventory").handler(message -> {
        message.fail(EXISTING_HTTP_STATUS_CODE, ERROR_CUSTOM_MESSAGE);
    });
    eventBus.<JsonObject> consumer("GET_store_order_orderId").handler(message -> {
        message.fail(EXISTING_HTTP_STATUS_CODE, null);
    });
    eventBus.<JsonObject> consumer("DELETE_store_order_orderId").handler(message -> {
        message.fail(EXISTING_HTTP_STATUS_CODE, "");
    });
    eventBus.<JsonObject> consumer("GET_pet_petId").handler(message -> {
        message.fail(NOT_EXISTING_HTTP_STATUS_CODE, ERROR_CUSTOM_MESSAGE);
    });
    eventBus.<JsonObject> consumer("POST_pet_petId").handler(message -> {
        message.fail(NOT_EXISTING_HTTP_STATUS_CODE, null);
    });
    eventBus.<JsonObject> consumer("DELETE_pet_petId").handler(message -> {
        message.fail(NOT_EXISTING_HTTP_STATUS_CODE, "");
    });
    eventBus.<JsonObject> consumer("POST_pet_petId_uploadImage").handler(message -> {
        message.fail(INVALID_HTTP_STATUS_CODE, ERROR_CUSTOM_MESSAGE);
    });
    eventBus.<JsonObject> consumer("GET_user_login").handler(message -> {
        message.fail(INVALID_HTTP_STATUS_CODE, null);
    });
    eventBus.<JsonObject> consumer("GET_pet_findByStatus").handler(message -> {
        message.fail(INVALID_HTTP_STATUS_CODE, "");
    });

    // init http Server
    HttpClientOptions options = new HttpClientOptions();
    options.setDefaultPort(TEST_PORT);
    httpClient = Vertx.vertx().createHttpClient();

}
 
Example 15
Source File: PathParameterExtractorTest.java    From vertx-swagger with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass(TestContext context) {
    Async before = context.async();
    vertx = Vertx.vertx();
    eventBus = vertx.eventBus();

    // init Router
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("extractors/swaggerPathExtractor.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, eventBus);

            httpServer = vertx.createHttpServer().requestHandler(swaggerRouter::accept).listen(TEST_PORT, TEST_HOST, listen -> {
                if (listen.succeeded()) {
                    before.complete();
                } else {
                    context.fail(listen.cause());
                }
            });
        } else {
            context.fail(readFile.cause());
        }
    });

    // init consumers
    eventBus.<JsonObject> consumer("GET_path_array_pipes_array_id").handler(message -> {
        message.reply(message.body().getJsonArray("array_id").encode());
    });
    eventBus.<JsonObject> consumer("GET_path_array_ssv_array_id").handler(message -> {
        message.reply(message.body().getJsonArray("array_id").encode());
    });
    eventBus.<JsonObject> consumer("GET_path_array_tsv_array_id").handler(message -> {
        message.reply(message.body().getJsonArray("array_id").encode());
    });
    eventBus.<JsonObject> consumer("GET_path_array_csv_array_id").handler(message -> {
        message.reply(message.body().getJsonArray("array_id").encode());
    });
    eventBus.<JsonObject> consumer("GET_path_array_array_id").handler(message -> {
        message.reply(message.body().getJsonArray("array_id").encode());
    });
    eventBus.<JsonObject> consumer("GET_path_simple_id").handler(message -> {
        message.reply(message.body().getString("id"));
    });

    // init http client
    httpClient = Vertx.vertx().createHttpClient();

}
 
Example 16
Source File: QueryParameterExtractorTest.java    From vertx-swagger with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass(TestContext context) {
    Async before = context.async();
    vertx = Vertx.vertx();
    eventBus = vertx.eventBus();

    // init Router
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("extractors/swaggerQueryExtractor.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, eventBus);

            httpServer = vertx.createHttpServer().requestHandler(swaggerRouter::accept).listen(TEST_PORT, TEST_HOST, listen -> {
                if (listen.succeeded()) {
                    before.complete();
                } else {
                    context.fail(listen.cause());
                }
            });
        } else {
            context.fail(readFile.cause());
        }
    });

    // init consumers
    eventBus.<JsonObject> consumer("GET_query_array_pipes").handler(message -> {
        message.reply(message.body().getJsonArray("array_query").encode());
    });
    eventBus.<JsonObject> consumer("GET_query_array_ssv").handler(message -> {
        message.reply(message.body().getJsonArray("array_query").encode());
    });
    eventBus.<JsonObject> consumer("GET_query_array_tsv").handler(message -> {
        message.reply(message.body().getJsonArray("array_query").encode());
    });
    eventBus.<JsonObject> consumer("GET_query_array_csv").handler(message -> {
        message.reply(message.body().getJsonArray("array_query").encode());
    });
    eventBus.<JsonObject> consumer("GET_query_array_multi").handler(message -> {
        message.reply(message.body().getJsonArray("array_query").encode());
    });
    eventBus.<JsonObject> consumer("GET_query_array").handler(message -> {
        message.reply(message.body().getJsonArray("array_query").encode());
    });
    eventBus.<JsonObject> consumer("GET_query_simple_required").handler(message -> {
        message.reply(message.body().getString("queryRequired"));
    });
    eventBus.<JsonObject> consumer("GET_query_simple_required_allowempty").handler(message -> {
        message.reply(message.body().getString("queryRequired"));
    });
    eventBus.<JsonObject> consumer("GET_query_simple_not_required").handler(message -> {
        message.reply(message.body().getString("queryNotRequired"));
    });
    eventBus.<JsonObject> consumer("GET_query_simple_not_required_withdefault").handler(message -> {
        message.reply(message.body().getString("queryNotRequired"));
    });
    // init http client
    httpClient = Vertx.vertx().createHttpClient();

}
 
Example 17
Source File: FormParameterExtractorTest.java    From vertx-swagger with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass(TestContext context) {
    Async before = context.async();
    vertx = Vertx.vertx();
    eventBus = vertx.eventBus();

    // init Router
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("extractors/swaggerFormExtractor.json", readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, eventBus);

            httpServer = vertx.createHttpServer().requestHandler(swaggerRouter::accept).listen(TEST_PORT, TEST_HOST, listen -> {
                if (listen.succeeded()) {
                    before.complete();
                } else {
                    context.fail(listen.cause());
                }
            });
        } else {
            context.fail(readFile.cause());
        }
    });

    // init consumers
    eventBus.<JsonObject> consumer("POST_formdata_array_pipes").handler(message -> {
        message.reply(message.body().getJsonArray("array_formdata").encode());
    });
    eventBus.<JsonObject> consumer("POST_formdata_array_ssv").handler(message -> {
        message.reply(message.body().getJsonArray("array_formdata").encode());
    });
    eventBus.<JsonObject> consumer("POST_formdata_array_tsv").handler(message -> {
        message.reply(message.body().getJsonArray("array_formdata").encode());
    });
    eventBus.<JsonObject> consumer("POST_formdata_array_csv").handler(message -> {
        message.reply(message.body().getJsonArray("array_formdata").encode());
    });
    eventBus.<JsonObject> consumer("POST_formdata_array_multi").handler(message -> {
        message.reply(message.body().getJsonArray("array_formdata").encode());
    });
    eventBus.<JsonObject> consumer("POST_formdata_array").handler(message -> {
        message.reply(message.body().getJsonArray("array_formdata").encode());
    });
    eventBus.<JsonObject> consumer("POST_formdata_simple_required").handler(message -> {
        message.reply(message.body().getString("formDataRequired"));
    });
    eventBus.<JsonObject> consumer("POST_formdata_simple_required_allowempty").handler(message -> {
        message.reply(message.body().getString("formDataRequired"));
    });
    eventBus.<JsonObject> consumer("POST_formdata_simple_not_required").handler(message -> {
        message.reply(message.body().getString("formDataNotRequired"));
    });
    eventBus.<JsonObject> consumer("POST_formdata_simple_file").handler(message -> {
        vertxFileSystem.readFile(message.body().getString("formDataRequired"), readFile -> {
            if (readFile.succeeded()) {
                message.reply(readFile.result().toString());
            } else {
                context.fail(readFile.cause());
            }
        });
    });
    // init http client
    httpClient = Vertx.vertx().createHttpClient();

}