for(Connector connector : server.getConnectors()) {
connector.setHeaderBufferSize(65535);
};
RewriteRuleHandler rewrite = new RewriteRuleHandler();
WebAppContext context = new WebAppContext();
context.setContextPath("/");
DefaultServlet defaultServlet = new DefaultServlet();
context.addServlet(new ServletHolder(new QueryServlet(handler)), "/api/query");
context.addServlet(new ServletHolder(new AdminServlet(handler)), "/api/admin");
context.addServlet(new ServletHolder(new DeployRollbackServlet(handler)), "/api/deploy");
context.addServlet(new ServletHolder(defaultServlet), "/panel/*");
context.addServlet(new ServletHolder(new com.yammer.metrics.reporting.AdminServlet()), "/metrics/*");
// No cache header in all responses... otherwise some browsers
// can decide to cache some requests and they shouldn't
context.addFilter(NoCacheFilter.class, "/*", Handler.DEFAULT);
// Adding support to GZip compression responses.
FilterHolder gzipFilter = context.addFilter(GzipFilter.class, "/*", Handler.REQUEST);
gzipFilter.setInitParameter("mimeTypes", "text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,image/svg+xml,application/json");
gzipFilter.setInitParameter("bufferSize", "16384");
gzipFilter.setInitParameter("methods", "GET,POST");
ResourceCollection resources = new ResourceCollection(new String[] { Resource
.newClassPathResource("panel").toString() });
context.setBaseResource(resources);
rewrite.setHandler(context);
server.setHandler(rewrite);
server.start();
address = "http://" + config.getString(QNodeProperties.HOST) + ":"
+ config.getInt(QNodeProperties.PORT);