use of com.sun.jersey.guice.JerseyServletModule in project platformlayer by platformlayer.
the class KeystoneAdminServer method main.
public static void main(String[] args) throws Exception {
List<Module> modules = Lists.newArrayList();
modules.add(new ConfigurationModule());
modules.add(new CacheModule());
modules.add(new GuiceAuthenticationConfig());
modules.add(new KeystoneJdbcModule());
modules.add(new KeystoneOpsSystemModule());
modules.add(new CodahaleMetricsModule());
modules.add(new JerseyServletModule() {
@Override
protected void configureServlets() {
bind(TokensResource.class);
bind(KeychainResource.class);
bind(PkiResource.class);
bind(ServicesResource.class);
Map<String, String> params = Maps.newHashMap();
params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "org.openstack.keystone.jaxrs;org.codehaus.jackson.jaxrs");
serve("/*").with(GuiceContainer.class, params);
}
});
Injector injector = Guice.createInjector(modules);
KeystoneAdminServer server = injector.getInstance(KeystoneAdminServer.class);
server.start(WellKnownPorts.PORT_PLATFORMLAYER_AUTH_ADMIN);
}
use of com.sun.jersey.guice.JerseyServletModule in project commons by twitter.
the class HttpStatsFilterIntegrationTest method setUp.
@Before
public void setUp() {
Stats.flush();
server = new JettyHttpServerDispatch();
server.listen(0);
server.registerFilter(GuiceFilter.class, "/*");
clock = new FakeClock();
final Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(TestServlet.class).in(Singleton.class);
bind(Clock.class).toInstance(clock);
bind(HttpStatsFilter.class).in(Singleton.class);
}
}, new JerseyServletModule() {
@Override
protected void configureServlets() {
filter("/*").through(HttpStatsFilter.class);
serve("/*").with(GuiceContainer.class, ImmutableMap.of(PROPERTY_CONTAINER_RESPONSE_FILTERS, HttpStatsFilter.class.getName()));
}
});
server.getRootContext().addEventListener(new GuiceServletContextListener() {
@Override
protected Injector getInjector() {
return injector;
}
});
ClientConfig config = new DefaultClientConfig();
client = Client.create(config);
}
use of com.sun.jersey.guice.JerseyServletModule in project commons by twitter.
the class Main method getModules.
@Override
public Iterable<? extends Module> getModules() {
return Arrays.asList(new HttpModule(), new LogModule(), new StatsModule(), new AbstractModule() {
@Override
protected void configure() {
bind(new TypeLiteral<Closure<String>>() {
}).toInstance(new Closure<String>() {
private final Client http = Client.create();
@Override
public void execute(String path) {
http.asyncResource("http://" + PING_TARGET.get() + path).get(String.class);
}
});
install(new JerseyServletModule() {
@Override
protected void configureServlets() {
filter("/ping*").through(GuiceContainer.class, ImmutableMap.<String, String>of());
Registration.registerEndpoint(binder(), "/ping");
bind(PingHandler.class);
}
});
}
});
}
Aggregations