本文整理汇总了Java中org.apache.cxf.jaxrs.client.WebClient.getConfig方法的典型用法代码示例。如果您正苦于以下问题:Java WebClient.getConfig方法的具体用法?Java WebClient.getConfig怎么用?Java WebClient.getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.jaxrs.client.WebClient
的用法示例。
在下文中一共展示了WebClient.getConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setClientAuthentication
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
private static void setClientAuthentication(Object client, String userName, String password) {
// Properties p = new Properties(); //PropertiesLoader.getPropertiesFromFile("config.properties");
ClientConfiguration config = WebClient.getConfig(client);
HTTPConduit httpConduit = (HTTPConduit) config.getConduit();
AuthorizationPolicy authorization = new AuthorizationPolicy();
authorization.setUserName(userName);
authorization.setPassword(password);
httpConduit.setAuthorization(authorization);
TLSClientParameters tlsParams = new TLSClientParameters();
TrustManager[] trustAllCerts = new TrustManager[] { new TrustManager() };
tlsParams.setTrustManagers(trustAllCerts);
// disables verification of the common name (the host for which the certificate has been issued)
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);
}
示例2: setup
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Before
public void setup() {
JacksonJsonProvider provider = new JacksonJsonProvider();
List providers = new ArrayList();
providers.add(provider);
api = JAXRSClientFactory.create("http://localhost", RemoteAccessApi.class, providers);
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
ClientConfiguration config = WebClient.getConfig(client);
}
示例3: setup
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Before
public void setup() {
JacksonJsonProvider provider = new JacksonJsonProvider();
List providers = new ArrayList();
providers.add(provider);
api = JAXRSClientFactory.create("http://localhost", BlueOceanApi.class, providers);
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
ClientConfiguration config = WebClient.getConfig(client);
}
示例4: prepareClient
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
protected WebClient prepareClient(String username, String password) {
List providers = new ArrayList<>();
providers.add(getProvider());
WebClient client = WebClient.create(ENDPOINT_ADDRESS, providers);// ,
// provider);
ClientConfiguration clientConfig = WebClient.getConfig(client);
clientConfig.getRequestContext().put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
client.accept(getAcceptHeader());
client.type(getContentType());
createAuthorizationHeader(client, username, password);
return client;
}