use of com.sun.jersey.api.client.config.DefaultClientConfig in project ff4j by ff4j.
the class ClientHttpJersey1Utils method buildJersey1Client.
/**
* Initializing jerseyClient.
*/
public static Client buildJersey1Client() {
ClientConfig config = new DefaultClientConfig();
config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
config.getSingletons().add(new JacksonJsonProvider());
config.getSingletons().add(new FF4jJacksonMapper());
return Client.create(config);
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project ff4j by ff4j.
the class SecuredFF4JResourceTestIT method configure.
/**
* {@inheritDoc}
*/
@Override
public WebAppDescriptor configure() {
ClientConfig cc = new DefaultClientConfig();
cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
return new WebAppDescriptor.Builder().initParam(WebComponent.APPLICATION_CONFIG_CLASS, //
SecuredFF4jProvider.class.getName()).clientConfig(cc).build();
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project coprhd-controller by CoprHD.
the class CinderApiFactory method getApi.
/**
* Return Cinder API client, create if not present
*
* @param provider Storage Provider URI
* @return
*/
public CinderApi getApi(URI provider, CinderEndPointInfo endPoint) {
boolean isNew = false;
CinderApi cinderApi = _clientMap.get(provider.toString());
if (cinderApi == null) {
isNew = true;
ClientConfig config = new DefaultClientConfig();
Client jerseyClient = Client.create(config);
cinderApi = new CinderApi(endPoint, jerseyClient);
_clientMap.putIfAbsent(provider.toString(), cinderApi);
}
if (!isNew) {
// Token gets expired, if the instance is not new refresh it.
cinderApi.getClient().setAuthTokenHeader(endPoint.getCinderToken());
}
return cinderApi;
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project coprhd-controller by CoprHD.
the class ClientRequestHelper method createClient.
/**
* Create an SSL-trusting Client using the specified configurations
*
* This method adds permissive HTTPSProperties settings to the
* configuration of the client.
*
* Note: Client objects are expensive to create and largely
* thread-safe so they should be re-used across requests
*
* @param readTimeout the read timeout
* @param connectTimeout the connect timeout
* @return the client
*/
public Client createClient(int readTimeout, int connectTimeout) {
ClientConfig config = new DefaultClientConfig();
config.getClasses().add(JacksonJaxbJsonProvider.class);
config.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, readTimeout);
config.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, connectTimeout);
return createClient(config);
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project data-access by pentaho.
the class TestDataSourceResource method init.
private static void init() {
ClientConfig clientConfig = new DefaultClientConfig();
client = Client.create(clientConfig);
client.addFilter(new HTTPBasicAuthFilter("joe", "password"));
}
Aggregations