Move the status and healthcheck to root level

This commit is contained in:
Shane Kilkelly 2020-06-19 15:50:27 +01:00
parent 8def058d85
commit ed778639a8

View file

@ -119,17 +119,26 @@ public class GitBridgeServer {
) throws ServletException { ) throws ServletException {
HandlerCollection handlers = new HandlerList(); HandlerCollection handlers = new HandlerList();
handlers.addHandler(initApiHandler()); handlers.addHandler(initApiHandler());
handlers.addHandler(initBaseHandler());
handlers.addHandler(initGitHandler(config, repoStore, snapshotApi)); handlers.addHandler(initGitHandler(config, repoStore, snapshotApi));
jettyServer.setHandler(handlers); jettyServer.setHandler(handlers);
} }
private Handler initBaseHandler() {
ContextHandler base = new ContextHandler();
base.setContextPath("/");
HandlerCollection handlers = new HandlerList();
handlers.addHandler(new StatusHandler(bridge));
handlers.addHandler(new HealthCheckHandler(bridge));
base.setHandler(handlers);
return base;
}
private Handler initApiHandler() { private Handler initApiHandler() {
ContextHandler api = new ContextHandler(); ContextHandler api = new ContextHandler();
api.setContextPath("/api"); api.setContextPath("/api");
HandlerCollection handlers = new HandlerList(); HandlerCollection handlers = new HandlerList();
handlers.addHandler(new StatusHandler(bridge));
handlers.addHandler(new HealthCheckHandler(bridge));
handlers.addHandler(initResourceHandler()); handlers.addHandler(initResourceHandler());
handlers.addHandler(new PostbackHandler(bridge)); handlers.addHandler(new PostbackHandler(bridge));
handlers.addHandler(new DefaultHandler()); handlers.addHandler(new DefaultHandler());