use of io.dropwizard.jetty.RoutingHandler in project dropwizard by dropwizard.
the class DefaultServerFactory method build.
@Override
public Server build(Environment environment) {
// ensures that the environment is configured before the server is built
configure(environment);
printBanner(environment.getName());
final ThreadPool threadPool = createThreadPool(environment.metrics());
final Server server = buildServer(environment.lifecycle(), threadPool);
final Handler applicationHandler = createAppServlet(server, environment.jersey(), environment.getObjectMapper(), environment.getValidator(), environment.getApplicationContext(), environment.getJerseyServletContainer(), environment.metrics());
final Handler adminHandler = createAdminServlet(server, environment.getAdminContext(), environment.metrics(), environment.healthChecks());
final RoutingHandler routingHandler = buildRoutingHandler(environment.metrics(), server, applicationHandler, adminHandler);
final Handler gzipHandler = buildGzipHandler(routingHandler);
server.setHandler(addStatsHandler(addRequestLog(server, gzipHandler, environment.getName())));
return server;
}
use of io.dropwizard.jetty.RoutingHandler in project dropwizard by dropwizard.
the class DefaultServerFactory method buildRoutingHandler.
private RoutingHandler buildRoutingHandler(MetricRegistry metricRegistry, Server server, Handler applicationHandler, Handler adminHandler) {
final List<Connector> appConnectors = buildAppConnectors(metricRegistry, server);
final List<Connector> adConnectors = buildAdminConnectors(metricRegistry, server);
final Map<Connector, Handler> handlers = new LinkedHashMap<>();
for (Connector connector : appConnectors) {
server.addConnector(connector);
handlers.put(connector, applicationHandler);
}
for (Connector connector : adConnectors) {
server.addConnector(connector);
handlers.put(connector, adminHandler);
}
return new RoutingHandler(handlers);
}
Aggregations