Search in sources :

Example 1 with ServletAdapter

use of com.sun.grizzly.http.servlet.ServletAdapter 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;
}
Also used : ServletAdapter(com.sun.grizzly.http.servlet.ServletAdapter) ServletContainer(com.sun.jersey.spi.container.servlet.ServletContainer) HTTPBasicAuth(org.apache.zookeeper.server.jersey.filters.HTTPBasicAuth) Credentials(org.apache.zookeeper.server.jersey.cfg.Credentials)

Aggregations

ServletAdapter (com.sun.grizzly.http.servlet.ServletAdapter)1 ServletContainer (com.sun.jersey.spi.container.servlet.ServletContainer)1 Credentials (org.apache.zookeeper.server.jersey.cfg.Credentials)1 HTTPBasicAuth (org.apache.zookeeper.server.jersey.filters.HTTPBasicAuth)1