use of org.apache.olingo.client.core.http.DefaultHttpClientFactory in project tdi-studio-se by Talend.
the class DynamicsCRMClient method init.
private void init() throws ServiceUnavailableException {
odataClient = ODataClientFactory.getClient();
if (clientConfiguration != null && serviceRootURL != null && serviceRootURL.indexOf("/api/data") > 0) {
clientConfiguration.setResource(serviceRootURL.substring(0, serviceRootURL.indexOf("/api/data")));
}
authResult = getAccessToken();
httpClientFactory = new DefaultHttpClientFactory() {
@Override
public DefaultHttpClient create(final HttpMethod method, final URI uri) {
if (!clientConfiguration.isReuseHttpClient() || httpClient == null) {
httpClient = super.create(method, uri);
HttpConnectionParams.setConnectionTimeout(httpClient.getParams(), clientConfiguration.getTimeout() * 1000);
HttpConnectionParams.setSoTimeout(httpClient.getParams(), clientConfiguration.getTimeout() * 1000);
// setup proxy
setHttpclientProxy(httpClient);
}
return httpClient;
}
};
odataClient.getConfiguration().setHttpClientFactory(httpClientFactory);
httpClient = (DefaultHttpClient) httpClientFactory.create(null, null);
}
Aggregations