use of org.apache.cxf.transports.http.configuration.HTTPClientPolicy in project cu-kfs by CU-CommunityApps.
the class CULegacyTravelServiceImpl method configureWebServiceClient.
/**
* @param client
*/
private void configureWebServiceClient(Client client) {
Endpoint endpoint = client.getConduitSelector().getEndpoint();
endpoint.getEndpointInfo().setAddress(updateTripEndpoint);
client.getConduitSelector().setEndpoint(endpoint);
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
httpConduit.setClient(httpClientPolicy);
}
use of org.apache.cxf.transports.http.configuration.HTTPClientPolicy in project teiid by teiid.
the class SalesforceCXFTransport method connectRaw.
private OutputStream connectRaw(String uri, HashMap<String, String> httpHeaders, boolean enableCompression) {
if (config.isTraceMessage()) {
config.getTraceStream().println("WSC: Creating a new connection to " + uri + " Proxy = " + config.getProxy() + " username " + config.getProxyUsername());
}
if (this.config.getCxfConfigFile() == null) {
this.client = WebClient.create(uri);
} else {
this.client = WebClient.create(uri, this.config.getCxfConfigFile());
}
this.client.header("User-Agent", VersionInfo.info());
/*
* Add all the client specific headers here
*/
if (config.getHeaders() != null) {
for (Entry<String, String> ent : config.getHeaders().entrySet()) {
this.client.header(ent.getKey(), ent.getValue());
}
}
if (enableCompression && config.isCompression()) {
this.client.header("Content-Encoding", "gzip");
this.client.header("Accept-Encoding", "gzip");
}
if (config.getProxyUsername() != null) {
String token = config.getProxyUsername() + ":" + config.getProxyPassword();
String auth = "Basic " + new String(Base64.encode(token.getBytes()));
this.client.header("Proxy-Authorization", auth);
this.client.header("Https-Proxy-Authorization", auth);
}
if (httpHeaders != null) {
for (Map.Entry<String, String> entry : httpHeaders.entrySet()) {
this.client.header(entry.getKey(), entry.getValue());
}
}
HTTPClientPolicy clientPolicy = WebClient.getConfig(this.client).getHttpConduit().getClient();
if (config.getReadTimeout() != 0) {
clientPolicy.setReceiveTimeout(config.getReadTimeout());
}
if (config.getConnectionTimeout() != 0) {
clientPolicy.setConnectionTimeout(config.getConnectionTimeout());
}
if (config.useChunkedPost()) {
clientPolicy.setAllowChunking(true);
clientPolicy.setChunkLength(4096);
}
if (config.getProxy() != Proxy.NO_PROXY) {
InetSocketAddress addr = (InetSocketAddress) config.getProxy().address();
clientPolicy.setProxyServer(addr.getHostName());
clientPolicy.setProxyServerPort(addr.getPort());
}
return this.payload;
}
use of org.apache.cxf.transports.http.configuration.HTTPClientPolicy in project components by Talend.
the class NetSuiteClientService method setHttpClientPolicy.
/**
* Set HTTP client policy for given port.
*
* @param port port
*/
protected void setHttpClientPolicy(PortT port) {
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(connectionTimeout);
httpClientPolicy.setReceiveTimeout(receiveTimeout);
setHttpClientPolicy(port, httpClientPolicy);
}
Aggregations