threadPool.setMaxThreads(settings.getAsInt("http.threads.max", 1000));
connector.setThreadPool(threadPool);
connector.setPort(settings.getAsInt("http.port", 8080));
server.addConnector(connector);
HandlerList handlers = new HandlerList();
if (settings.getAsBoolean("application.static.enable", false)) {
ResourceHandler resource_handler = new ResourceHandler();
resource_handler.setDirectoriesListed(false);
try {
resource_handler.setBaseResource(Resource.newResource(environment.templateDirFile().getPath() + "/assets/"));
} catch (IOException e) {
e.printStackTrace();
}
if (settings.getAsBoolean("application.session.enable", false)) {
SessionManager sessionManager = new HashSessionManager();
sessionManager.setSessionIdPathParameterName("none");
handlers.setHandlers(new Handler[]{resource_handler, new SessionHandler(sessionManager), new DefaultHandler()});
} else {
handlers.setHandlers(new Handler[]{resource_handler, new DefaultHandler()});
}
} else {
handlers.setHandlers(new Handler[]{new DefaultHandler()});
}
server.setHandler(handlers);
}