本文整理汇总了Java中io.vertx.ext.web.handler.ErrorHandler类的典型用法代码示例。如果您正苦于以下问题:Java ErrorHandler类的具体用法?Java ErrorHandler怎么用?Java ErrorHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorHandler类属于io.vertx.ext.web.handler包,在下文中一共展示了ErrorHandler类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import io.vertx.ext.web.handler.ErrorHandler; //导入依赖的package包/类
@Override
public void start(Future<Void> fut) throws IOException, URISyntaxException {
LOGGER.info("Starting <{}>", this.getClass().getSimpleName());
httpServer = vertx.createHttpServer();
Router router = Router.router(vertx);
router.route().handler(BodyHandler.create());
router.route().method(HttpMethod.POST).handler(createPostHandler());
router.route().method(HttpMethod.GET).handler(createGetHandler());
router.route().failureHandler(ErrorHandler.create(true));
httpServer.requestHandler(router::accept).listen(
config().getInteger("httpPort"),
result -> {
if (result.succeeded()) {
LOGGER.info("Mock Service server started. Listening on port {}",
config().getInteger("httpPort"));
fut.complete();
} else {
LOGGER.error("Unable to start Mock Service server.", result.cause());
fut.fail(result.cause());
}
});
}
示例2: start
import io.vertx.ext.web.handler.ErrorHandler; //导入依赖的package包/类
@Override
public void start(Future<Void> fut) throws IOException, URISyntaxException {
LOGGER.info("Starting <{}>", this.getClass().getSimpleName());
httpServer = vertx.createHttpServer();
Router router = Router.router(vertx);
router.route().method(HttpMethod.GET).handler(createRepositoryHandler());
router.route().failureHandler(ErrorHandler.create(true));
httpServer.requestHandler(router::accept).listen(
config().getInteger("httpPort"),
result -> {
if (result.succeeded()) {
LOGGER.info("Mock Remote Repository server started. Listening on port {}",
config().getInteger("httpPort"));
fut.complete();
} else {
LOGGER.error("Unable to start Mock Remote Repository server.", result.cause());
fut.fail(result.cause());
}
});
}
示例3: start
import io.vertx.ext.web.handler.ErrorHandler; //导入依赖的package包/类
@Override
public void start() {
Router router = Router.router(vertx);
router.route().handler(CookieHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
AuthProvider authProvider = ShiroAuth.create(vertx, ShiroAuthRealmType.PROPERTIES, new JsonObject());
router.route().handler(UserSessionHandler.create(authProvider));
router.route("/private/*").handler(RedirectAuthHandler.create(authProvider, "/login.html"));
router.mountSubRouter("/tokens", tokenRouter(authProvider));
router.mountSubRouter("/api", auctionApiRouter());
router.route().failureHandler(ErrorHandler.create(true));
router.route("/private/*").handler(staticHandler("private"));
router.route().handler(staticHandler("public"));
vertx.createHttpServer().requestHandler(router::accept).listen(8080);
}
示例4: start
import io.vertx.ext.web.handler.ErrorHandler; //导入依赖的package包/类
@Override
public void start() {
Router router = Router.router(vertx);
router.route().handler(CookieHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
AuthProvider authProvider = ShiroAuth.create(
vertx,
new ShiroAuthOptions().setType(ShiroAuthRealmType.PROPERTIES).setConfig(new JsonObject())
);
router.route().handler(UserSessionHandler.create(authProvider));
router.route("/private/*").handler(RedirectAuthHandler.create(authProvider, "/login.html"));
router.mountSubRouter("/tokens", tokenRouter(authProvider));
router.mountSubRouter("/api", auctionApiRouter());
router.route().failureHandler(ErrorHandler.create(true));
router.route("/private/*").handler(staticHandler("private"));
router.route().handler(staticHandler("public"));
vertx.createHttpServer().requestHandler(router::accept).listen(8080);
}
示例5: errorHandler
import io.vertx.ext.web.handler.ErrorHandler; //导入依赖的package包/类
private ErrorHandler errorHandler() {
return ErrorHandler.create();
}