Add loader.io verification

This commit is contained in:
Colin McDonald 2016-06-18 10:03:31 -04:00
parent 9054974f55
commit 56487b04a7
2 changed files with 21 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.frozenorb.apiv3.handler.ActorAttributeHandler; import net.frozenorb.apiv3.handler.ActorAttributeHandler;
import net.frozenorb.apiv3.handler.AuthorizationHandler; import net.frozenorb.apiv3.handler.AuthorizationHandler;
import net.frozenorb.apiv3.handler.LoaderIoHandler;
import net.frozenorb.apiv3.route.GETDump; import net.frozenorb.apiv3.route.GETDump;
import net.frozenorb.apiv3.route.GETWhoAmI; import net.frozenorb.apiv3.route.GETWhoAmI;
import net.frozenorb.apiv3.route.POSTMetrics; import net.frozenorb.apiv3.route.POSTMetrics;
@ -235,6 +236,7 @@ public final class APIv3 extends AbstractVerticle {
HttpServer webServer = vertx.createHttpServer(); HttpServer webServer = vertx.createHttpServer();
Router mainRouter = Router.router(vertx); Router mainRouter = Router.router(vertx);
mainRouter.route().handler(new LoaderIoHandler());
mainRouter.route().handler(new ActorAttributeHandler()); mainRouter.route().handler(new ActorAttributeHandler());
mainRouter.route().handler(new AuthorizationHandler()); mainRouter.route().handler(new AuthorizationHandler());
mainRouter.route().handler(LoggerHandler.create(LoggerFormat.TINY)); mainRouter.route().handler(LoggerHandler.create(LoggerFormat.TINY));

View File

@ -0,0 +1,19 @@
package net.frozenorb.apiv3.handler;
import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
public final class LoaderIoHandler implements Handler<RoutingContext> {
@Override
public void handle(RoutingContext ctx) {
String path = ctx.request().path().replace("/", "");
if (path.equals("loaderio-1c81aa574f79c573e7220e15e30a96aa")) {
ctx.response().end(path);
} else {
ctx.next();
}
}
}