Ejemplo n.º 1
0
 private void configureSessionsAndSecurity(MutableServletContextHandler handler, Server server) {
   handler.setServer(server);
   if (handler.isSecurityEnabled()) {
     handler.getSecurityHandler().setServer(server);
   }
   if (handler.isSessionsEnabled()) {
     handler.getSessionHandler().setServer(server);
   }
 }
Ejemplo n.º 2
0
 protected Handler createAdminServlet(
     Server server,
     MutableServletContextHandler handler,
     MetricRegistry metrics,
     HealthCheckRegistry healthChecks) {
   configureSessionsAndSecurity(handler, server);
   handler.setServer(server);
   handler.getServletContext().setAttribute(MetricsServlet.METRICS_REGISTRY, metrics);
   handler
       .getServletContext()
       .setAttribute(HealthCheckServlet.HEALTH_CHECK_REGISTRY, healthChecks);
   handler.addServlet(new NonblockingServletHolder(new AdminServlet()), "/*");
   handler
       .addFilter(AllowedMethodsFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST))
       .setInitParameter(
           AllowedMethodsFilter.ALLOWED_METHODS_PARAM, Joiner.on(',').join(allowedMethods));
   return handler;
 }