作者:1500799277_a9483d_353 | 来源:互联网 | 2023-09-18 17:04
本文整理了Java中org.apache.cxf.transports.http.configuration.HTTPClientPolicy.setConnection()
本文整理了Java中org.apache.cxf.transports.http.configuration.HTTPClientPolicy.setConnection()
方法的一些代码示例,展示了HTTPClientPolicy.setConnection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HTTPClientPolicy.setConnection()
方法的具体详情如下:
包路径:org.apache.cxf.transports.http.configuration.HTTPClientPolicy
类名称:HTTPClientPolicy
方法名:setConnection
HTTPClientPolicy.setConnection介绍
[英]Sets the value of the connection property.
[中]设置连接属性的值。
代码示例
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
p.setChunkLength(Integer.parseInt(v.trim()));
} else if ("Connection".equals(k)) {
p.setConnection(ConnectionType.valueOf(v));
} else if ("DecoupledEndpoint".equals(k)) {
p.setDecoupledEndpoint(v);
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
p.setConnection(p1.getConnection());
} else if (p2.isSetConnection()) {
p.setConnection(p2.getConnection());
代码示例来源:origin: stackoverflow.com
URL url = null;
try {
url = new URL(endpoint + "/wsdl");
} catch (MalformedURLException e) {
LOG.error(e.getMessage());
}
javax.xml.ws.Service s = MyService.create(url, new QName(MyService.NAMESPACE, MyService.SERVICE));
ServiceSoap port = s.getPort(ServiceSoap.class);
Map reqCtx = ((BindingProvider)port).getRequestContext();
reqCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
reqCtx.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
reqCtx.put(BindingProvider.SOAPACTION_URI_PROPERTY, actionName);
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnection(ConnectionType.CLOSE);
http.setClient(httpClientPolicy);
TLSClientParameters tls = new TLSClientParameters();
tls.setSSLSocketFactory(sslFactory);
tls.setDisableCNCheck(true);
http.setTlsClientParameters(tls);
代码示例来源:origin: stackoverflow.com
@Component("endpointConfigurer")
public class TemplateEndpointConfigurer implements CxfEndpointConfigurer {
@Override
public void configure(AbstractWSDLBasedEndpointFactory factoryBean) {
// Do nothing here
}
@Override
public void configureClient(Client client) {
final HTTPConduit cOnduit= (HTTPConduit) client.getConduit();
final HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setConnectionTimeout(webServiceConnectionTimeout);
policy.setReceiveTimeout(webServiceReadTimeout);
policy.setConnection(ConnectionType.CLOSE);
conduit.setClient(policy);
}
@Override
public void configureServer(Server server) {
// Do nothing here
}
}
代码示例来源:origin: apache/cxf
p.setConnection(p1.getConnection());
} else if (p2.isSetConnection()) {
p.setConnection(p2.getConnection());
代码示例来源:origin: stackoverflow.com
...
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setAutoRedirect(true);
httpClientPolicy.setConnection(ConnectionType.KEEP_ALIVE);
String proxyUrl = "http://proxy.com";
String proxyPortString = "8080";
HTTPConduit http = (HTTPConduit)client.getConduit();
SSLContext sslCOntext= SSLContext.getInstance("TLSv1");
sslContext.init(null, null, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
TLSClientParameters tlsClientParameters = new TLSClientParameters();
tlsClientParameters.setUseHttpsURLConnectionDefaultSslSocketFactory(true);
http.setTlsClientParameters(tlsClientParameters);
http.setClient(httpClientPolicy);
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
p.setChunkLength(Integer.parseInt(v.trim()));
} else if ("Connection".equals(k)) {
p.setConnection(ConnectionType.valueOf(v));
} else if ("DecoupledEndpoint".equals(k)) {
p.setDecoupledEndpoint(v);
代码示例来源:origin: apache/cxf
public static void setKeepAliveConnection(Object proxy, boolean keepAlive, boolean force) {
if (force || "HP-UX".equals(System.getProperty("os.name"))
|| "Windows XP".equals(System.getProperty("os.name"))) {
Client client = ClientProxy.getClient(proxy);
HTTPConduit hc = (HTTPConduit)client.getConduit();
HTTPClientPolicy cp = hc.getClient();
cp.setConnection(keepAlive ? ConnectionType.KEEP_ALIVE : ConnectionType.CLOSE);
}
}
代码示例来源:origin: apache/cxf
p.setChunkLength(Integer.parseInt(v.trim()));
} else if ("Connection".equals(k)) {
p.setConnection(ConnectionType.valueOf(v));
} else if ("DecoupledEndpoint".equals(k)) {
p.setDecoupledEndpoint(v);
代码示例来源:origin: apache/cxf
private void doWork(URL wsdlUrl, String address) {
SOAPService service = new SOAPService(wsdlUrl);
assertNotNull(service);
Greeter greeter = service.getSoapPort();
// overwrite client address
InvocationHandler handler = Proxy.getInvocationHandler(greeter);
BindingProvider bp = (BindingProvider)handler;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
address);
Client client = ClientProxy.getClient(greeter);
HTTPConduit c = (HTTPConduit)client.getConduit();
c.setClient(new HTTPClientPolicy());
c.getClient().setConnection(ConnectionType.CLOSE);
// invoke twoway call
greeter.sayHi();
}
代码示例来源:origin: org.jboss.ws.cxf/jbossws-cxf-client
httpClientPolicy.setConnection(ConnectionType.fromValue(connection));
代码示例来源:origin: uk.gov.nationalarchives/droid-results
/**
* {@inheritDoc}
*/
@Override
public void onProxyChange(ProxySettings proxySettings) {
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnection(ConnectionType.CLOSE);
httpClientPolicy.setAllowChunking(true);
httpClientPolicy.setCacheControl(ClientCacheControlType.NO_CACHE);
if (proxySettings.isEnabled()) {
httpClientPolicy.setProxyServer(proxySettings.getProxyHost());
httpClientPolicy.setProxyServerPort(proxySettings.getProxyPort());
httpClientPolicy.setProxyServerType(ProxyServerType.HTTP);
} else {
httpClientPolicy.setProxyServer(null);
httpClientPolicy.unsetProxyServerPort();
httpClientPolicy.setProxyServerType(null);
}
Client client = ClientProxy.getClient(pronomService);
HTTPConduit http = (HTTPConduit) client.getConduit();
http.setClient(httpClientPolicy);
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
p.setConnection(p1.getConnection());
} else if (p2.isSetConnection()) {
p.setConnection(p2.getConnection());
代码示例来源:origin: digital-preservation/droid
/**
* {@inheritDoc}
*/
@Override
public void onProxyChange(ProxySettings proxySettings) {
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnection(ConnectionType.CLOSE);
httpClientPolicy.setAllowChunking(true);
httpClientPolicy.setCacheControl("no-cache");
if (proxySettings.isEnabled()) {
httpClientPolicy.setProxyServer(proxySettings.getProxyHost());
httpClientPolicy.setProxyServerPort(proxySettings.getProxyPort());
httpClientPolicy.setProxyServerType(ProxyServerType.HTTP);
} else {
httpClientPolicy.setProxyServer(null);
httpClientPolicy.setProxyServerPort(null);
httpClientPolicy.setProxyServerType(null);
}
Client client = ClientProxy.getClient(pronomService);
HTTPConduit http = (HTTPConduit) client.getConduit();
http.setClient(httpClientPolicy);
}