org.apache.cxf.endpoint.Client.getConduit()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(235)

本文整理了Java中org.apache.cxf.endpoint.Client.getConduit()方法的一些代码示例,展示了Client.getConduit()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Client.getConduit()方法的具体详情如下:
包路径:org.apache.cxf.endpoint.Client
类名称:Client
方法名:getConduit

Client.getConduit介绍

[英]Get the Conduit that messages for this client will be sent on.
[中]获取用于发送此客户端消息的管道。

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean();
  proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString());
  proxyFactoryBean.setServiceClass(serviceType);
  proxyFactoryBean.setBus(bus);
  T ref = (T) proxyFactoryBean.create();
  Client proxy = ClientProxy.getClient(ref);
  HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
  HTTPClientPolicy policy = new HTTPClientPolicy();
  policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
  policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
  conduit.setClient(policy);
  return ref;
}

代码示例来源:origin: apache/incubator-dubbo

@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean();
  proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString());
  proxyFactoryBean.setServiceClass(serviceType);
  proxyFactoryBean.setBus(bus);
  T ref = (T) proxyFactoryBean.create();
  Client proxy = ClientProxy.getClient(ref);
  HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
  HTTPClientPolicy policy = new HTTPClientPolicy();
  policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
  policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
  conduit.setClient(policy);
  return ref;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

@Override
public void initialize(Client client, Bus bus) {
  Conduit conduit = client.getConduit();
  if (conduitConfig != null && conduit instanceof HTTPConduit) {
    conduitConfig.apply((HTTPConduit)conduit);
  }
}

代码示例来源:origin: opensourceBIM/BIMserver

public void connect(TokenHolder tokenHolder) {
  for (Class<? extends PublicInterface> interface1 : interfaces) {
    JaxWsProxyFactoryBean cpfb = new JaxWsProxyFactoryBean();
    cpfb.setServiceClass(interface1);
    cpfb.setAddress(address + "/" + interface1.getSimpleName());
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put("mtom-enabled", Boolean.TRUE);
    cpfb.setProperties(properties);
    
    PublicInterface serviceInterface = (PublicInterface) cpfb.create();
    
    client = ClientProxy.getClient(serviceInterface);
    HTTPConduit http = (HTTPConduit) client.getConduit();
    http.getClient().setConnectionTimeout(360000);
    http.getClient().setAllowChunking(false);
    http.getClient().setReceiveTimeout(320000);
    
    if (!useSoapHeaderSessions) {
      ((BindingProvider) serviceInterface).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
    }
    add(interface1.getName(), serviceInterface);
  }
  tokenHolder.registerTokenChangeListener(this);
  notifyOfConnect();
}

代码示例来源:origin: apache/cxf

@Override
public void initialize(Client client, Bus bus) {
  Conduit conduit = client.getConduit();
  if (conduitConfig != null && conduit instanceof HTTPConduit) {
    conduitConfig.apply((HTTPConduit)conduit);
  }
}

代码示例来源:origin: org.apache.camel/camel-cxf

@Override
public void configureClient(Client client) {
  HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
  setupHttpConduit(httpConduit);
}

代码示例来源:origin: Talend/components

protected void setHttpClientPolicy(PortT port, HTTPClientPolicy httpClientPolicy) {
  Client proxy = ClientProxy.getClient(port);
  HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
  conduit.setClient(httpClientPolicy);
}

代码示例来源:origin: stackoverflow.com

DynamicClientFactory dcf = DynamicClientFactory.newInstance();
 Client client = dcf.createClient("WSDL Location");
 AuthorizationPolicy authorization = ((HTTPConduit) client.getConduit()).getAuthorization();
 authorization.setUserName(
     "user name"
 );
 authorization.setPassword(
     "password"
 );
 Object[] res = client.invoke(new QName("http://targetNameSpace/", "operationName"), params...);
 System.out.println("Echo response: " + res[0]);

代码示例来源:origin: apache/cxf

public void clientCreated(final Client client) {
  if (null == store || null == retransmissionQueue) {
    return;
  }
  String id = RMUtils.getEndpointIdentifier(client.getEndpoint(), getBus());
  Collection<SourceSequence> sss = store.getSourceSequences(id/*, protocol*/);
  if (null == sss || 0 == sss.size()) {
    return;
  }
  LOG.log(Level.FINE, "Number of source sequences: {0}", sss.size());
  recoverReliableEndpoint(client.getEndpoint(), client.getConduit()/*, protocol*/);
}

代码示例来源:origin: stackoverflow.com

ProxyWs proxy = (ProxyWs) factory.create();
Client client = ClientProxy.getClient(proxy);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(0);
httpClientPolicy.setReceiveTimeout(0);
http.setClient(httpClientPolicy);

代码示例来源:origin: stackoverflow.com

private void setProxySetting(EventPortType port) {
  try{
  Client client = ClientProxy.getClient(port);
  HTTPConduit http = (HTTPConduit) client.getConduit();
  http.getClient().setProxyServer("***host***");
  http.getClient().setProxyServerPort(80);
  http.getProxyAuthorization().setUserName("***username***");
  http.getProxyAuthorization().setPassword("***password***");
 }catch (Exception e) {
 logger.error("Please Enter your proxy setting in MyClass class", e);
 }
}

代码示例来源:origin: stackoverflow.com

ProxyWs proxy = (ProxyWs) factory.create();
Client client = ClientProxy.getClient(proxy);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(0);
httpClientPolicy.setReceiveTimeout(0);
http.setClient(httpClientPolicy);

代码示例来源:origin: stackoverflow.com

Client client = ClientProxy.getClient(proxy);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(0);
httpClientPolicy.setReceiveTimeout(0);
http.setClient(httpClientPolicy);

代码示例来源: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: stackoverflow.com

MyWebService service = new MyWebService();
MyWebServicePortType client = service.MyWebServicePort();

Client cl = ClientProxy.getClient(client);

HTTPConduit http = (HTTPConduit) cl.getConduit();

HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(0);
httpClientPolicy.setReceiveTimeout(0);

http.setClient(httpClientPolicy);

client.doSomething(...);

代码示例来源:origin: apache/cxf

@Override
public void initialize(Client client, Bus bus) {
  checkJmsConfig();
  Conduit conduit = client.getConduit();
  if (!(conduit instanceof JMSConduit)) {
    throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
  }
  JMSConduit jmsConduit = (JMSConduit)conduit;
  jmsConduit.setJmsConfig(jmsConfig);
  super.initialize(client, bus);
}

代码示例来源:origin: org.kantega.respiro/respiro-cxf-plugin

private void configureTimeouts(P port) {
  Client client = getClient(port);
  HTTPConduit conduit = (HTTPConduit) client.getConduit();
  HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
  httpClientPolicy.setConnectionTimeout(connectionTimeoutMs);
  httpClientPolicy.setReceiveTimeout(receiveTimeoutMs);
  httpClientPolicy.setAutoRedirect(true);
  httpClientPolicy.setAllowChunking(true);
  conduit.setClient(httpClientPolicy);
}

代码示例来源:origin: todvora/eet-client

private void configureTimeout(final Client clientProxy) {
  final HTTPConduit conduit = (HTTPConduit) clientProxy.getConduit();
  final HTTPClientPolicy policy = new HTTPClientPolicy();
  policy.setReceiveTimeout(this.wsConfiguration.getReceiveTimeout());
  policy.setConnectionTimeout(this.wsConfiguration.getReceiveTimeout());
  policy.setAsyncExecuteTimeout(this.wsConfiguration.getReceiveTimeout());
  conduit.setClient(policy);
}

代码示例来源:origin: apache/cxf

public void configureProxy(Client client) {
  HTTPConduit cond = (HTTPConduit)client.getConduit();
  HTTPClientPolicy pol = cond.getClient();
  if (pol == null) {
    pol = new HTTPClientPolicy();
    cond.setClient(pol);
  }
  pol.setProxyServer("localhost");
  pol.setProxyServerPort(PROXY_PORT);
}

代码示例来源:origin: apache/cxf

public void configureProxy(Client client) {
  HTTPConduit cond = (HTTPConduit)client.getConduit();
  HTTPClientPolicy pol = cond.getClient();
  if (pol == null) {
    pol = new HTTPClientPolicy();
    cond.setClient(pol);
  }
  pol.setProxyServer("localhost");
  pol.setProxyServerPort(PROXY_PORT);
}

相关文章