private ServletAdapter createJerseyAdapter(Endpoint e) { ServletAdapter jersey = new ServletAdapter(); jersey.setServletInstance(new ServletContainer()); jersey.addInitParameter("com.sun.jersey.config.property.packages", "org.apache.zookeeper.server.jersey.resources"); jersey.setContextPath(e.getContext()); Credentials c = Credentials.join(e.getCredentials(), cfg .getCredentials()); if (!c.isEmpty()) { jersey.addFilter(new HTTPBasicAuth(c), e.getContext() + "-basic-auth", null); } return jersey; }
public HTTPBasicAuth(Credentials c) { credentials = c; }