use of com.sun.jersey.api.client.config.ClientConfig in project hadoop by apache.
the class TestTimelineReaderWebServicesHBaseStorage method createClient.
private static Client createClient() {
ClientConfig cfg = new DefaultClientConfig();
cfg.getClasses().add(YarnJacksonJaxbJsonProvider.class);
return new Client(new URLConnectionClientHandler(new DummyURLConnectionFactory()), cfg);
}
use of com.sun.jersey.api.client.config.ClientConfig in project hadoop by apache.
the class TestTimelineReaderWebServices method createClient.
private static Client createClient() {
ClientConfig cfg = new DefaultClientConfig();
cfg.getClasses().add(YarnJacksonJaxbJsonProvider.class);
return new Client(new URLConnectionClientHandler(new DummyURLConnectionFactory()), cfg);
}
use of com.sun.jersey.api.client.config.ClientConfig 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.api.client.config.ClientConfig in project nhin-d by DirectProject.
the class TestUtils method getResource.
public static WebResource getResource(String serviceURL) {
final ClientConfig config = new DefaultClientConfig();
config.getSingletons().add(new TxJSONProvider());
// need to set timeouts so we don't block forever in the event of a bad URL or hung web server
config.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, CONNECTION_TIMEOUT);
config.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, READ_TIMEOUT);
final Client client = Client.create(config);
WebResource resource = client.resource(serviceURL);
return resource;
}
use of com.sun.jersey.api.client.config.ClientConfig in project ORCID-Source by ORCID.
the class CrossRefManagerImpl method createClient.
private Client createClient() {
Set<Class<?>> providers = new HashSet<Class<?>>();
providers.add(JacksonJsonProvider.class);
ClientConfig config = new DefaultClientConfig(providers);
config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
Client client = ApacheHttpClient4.create(config);
client.setFollowRedirects(true);
client.addFilter(new ContentTypeFromTextToJsonClientFilter());
return client;
}
Aggregations