use of org.apache.zookeeper.server.jersey.cfg.Credentials in project zookeeper by apache.
the class RestMain method createJerseyAdapter.
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;
}
Aggregations