Search in sources :

Example 1 with ContextRoutingHandler

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;
}
Also used : Connector(org.eclipse.jetty.server.Connector) Server(org.eclipse.jetty.server.Server) ContextRoutingHandler(io.dropwizard.jetty.ContextRoutingHandler) ThreadPool(org.eclipse.jetty.util.thread.ThreadPool) Handler(org.eclipse.jetty.server.Handler) ContextRoutingHandler(io.dropwizard.jetty.ContextRoutingHandler)

Aggregations

ContextRoutingHandler (io.dropwizard.jetty.ContextRoutingHandler)1 Connector (org.eclipse.jetty.server.Connector)1 Handler (org.eclipse.jetty.server.Handler)1 Server (org.eclipse.jetty.server.Server)1 ThreadPool (org.eclipse.jetty.util.thread.ThreadPool)1