use of com.sun.jersey.api.client.config.ClientConfig in project nutch by apache.
the class NutchClientImpl method createClient.
public void createClient() {
ClientConfig clientConfig = new DefaultClientConfig();
clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
this.client = Client.create(clientConfig);
this.nutchResource = client.resource(instance.getUrl());
}
use of com.sun.jersey.api.client.config.ClientConfig in project opennms by OpenNMS.
the class RestClientTest method setUp.
@Before
public void setUp() {
ClientConfig config = new DefaultClientConfig();
m_client = Client.create(config);
m_client.addFilter(new HTTPBasicAuthFilter("demo", "demo"));
m_resource = m_client.resource("http://demo.opennms.org/opennms/rest/alarms");
}
use of com.sun.jersey.api.client.config.ClientConfig in project ORCID-Source by ORCID.
the class OrcidJerseyClientHandler method create.
public static Client create(boolean isDevelopmentMode, Map<String, Object> properties) {
ClientConfig config = null;
if (isDevelopmentMode) {
// DANGER!!! Trust all certs
LOGGER.info("TRUSTING ALL SSL CERTS IN DEV MODE!!!");
config = new DevJerseyClientConfig();
} else {
config = new DefaultClientConfig();
}
Set<String> keyset = properties.keySet();
for (String key : keyset) {
config.getProperties().put(key, properties.get(key));
}
config.getClasses().add(JacksonJaxbJsonProvider.class);
return Client.create(config);
}
use of com.sun.jersey.api.client.config.ClientConfig in project nhin-d by DirectProject.
the class BaseTestPlan method getResource.
public static WebResource getResource(String serviceURL) {
final ClientConfig config = new DefaultClientConfig();
config.getSingletons().add(new ConfigJSONProvider());
// 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 hadoop by apache.
the class TimelineConnector method serviceInit.
@Override
protected void serviceInit(Configuration conf) throws Exception {
super.serviceInit(conf);
ClientConfig cc = new DefaultClientConfig();
cc.getClasses().add(YarnJacksonJaxbJsonProvider.class);
sslFactory = getSSLFactory(conf);
connConfigurator = getConnConfigurator(sslFactory);
if (UserGroupInformation.isSecurityEnabled()) {
authenticator = new KerberosDelegationTokenAuthenticator();
} else {
authenticator = new PseudoDelegationTokenAuthenticator();
}
authenticator.setConnectionConfigurator(connConfigurator);
connectionRetry = new TimelineClientConnectionRetry(conf);
client = new Client(new URLConnectionClientHandler(new TimelineURLConnectionFactory(authUgi, authenticator, connConfigurator, token, doAsUser)), cc);
if (requireConnectionRetry) {
TimelineJerseyRetryFilter retryFilter = new TimelineJerseyRetryFilter(connectionRetry);
client.addFilter(retryFilter);
}
}
Aggregations