use of io.dropwizard.jetty.ContextRoutingHandler in project dropwizard by dropwizard.
the class SimpleServerFactory 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 Connector conn = connector.build(server, environment.metrics(), environment.getName(), null);
server.addConnector(conn);
final ContextRoutingHandler routingHandler = new ContextRoutingHandler(ImmutableMap.of(applicationContextPath, applicationHandler, adminContextPath, adminHandler));
final Handler gzipHandler = buildGzipHandler(routingHandler);
server.setHandler(addStatsHandler(addRequestLog(server, gzipHandler, environment.getName())));
return server;
}
Aggregations