当前位置: 首页>>代码示例>>Java>>正文


Java WebClient.fromClient方法代码示例

本文整理汇总了Java中org.apache.cxf.jaxrs.client.WebClient.fromClient方法的典型用法代码示例。如果您正苦于以下问题:Java WebClient.fromClient方法的具体用法?Java WebClient.fromClient怎么用?Java WebClient.fromClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cxf.jaxrs.client.WebClient的用法示例。


在下文中一共展示了WebClient.fromClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendRequest

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
public <T> T sendRequest (Function <WebClient, T> request) {
	int retries = 0;
	do {
		try {
			WebClient webClientCopy = WebClient.fromClient(webClient);
			T response = request.apply(webClientCopy);
			webClientCopy.close();
			return response;
		}
		catch (NotAuthorizedException e) {
			if (retries < 5) {
				retries ++;
				authClient.refreshAuthenticationContext();
			}
			else throw e;
		}
	} 
	while (retries < 5);
	
	return null;
}
 
开发者ID:ser316asu,项目名称:Reinickendorf_SER316,代码行数:22,代码来源:ApiClient.java

示例2: getGroup

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Override
public GSuiteGroup getGroup(String groupKey) {
    String path = MessageFormat.format("groups/{0}", new Object[]{groupKey});

    WebClient webClient = WebClient.fromClient(directoryApiClient, true);

    ClientAccessToken accessToken = tokenCache.get();
    webClient.authorization(accessToken);
    GSuiteGroup group = webClient.path(path).get(GSuiteGroup.class);
    return group;
}
 
开发者ID:hlavki,项目名称:g-suite-identity-sync,代码行数:12,代码来源:GSuiteDirectoryServiceImpl.java

示例3: getUser

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Override
public GSuiteUser getUser(String userKey) {
    String path = MessageFormat.format("users/{0}", new Object[]{userKey});
    WebClient webClient = WebClient.fromClient(directoryApiClient, true);

    ClientAccessToken accessToken = tokenCache.get();
    webClient.authorization(accessToken);
    GSuiteUser user = webClient.path(path).get(GSuiteUser.class);
    return user;
}
 
开发者ID:hlavki,项目名称:g-suite-identity-sync,代码行数:11,代码来源:GSuiteDirectoryServiceImpl.java

示例4: updateUserPassword

import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Override
public void updateUserPassword(String userKey, String password) throws InvalidPasswordException {
    String path = MessageFormat.format("users/{0}", new Object[]{userKey});
    WebClient webClient = WebClient.fromClient(directoryApiClient, true);

    ClientAccessToken accessToken = tokenCache.get();
    webClient.authorization(accessToken);
    GSuiteUser user = new GSuiteUser();
    user.setPassword(password);
    Response response = webClient.path(path).put(user);
    if (response.getStatus() != Response.Status.OK.getStatusCode()) {
        throw new InvalidPasswordException("Can't change password. Response: " + response.readEntity(String.class));
    }
}
 
开发者ID:hlavki,项目名称:g-suite-identity-sync,代码行数:15,代码来源:GSuiteDirectoryServiceImpl.java


注:本文中的org.apache.cxf.jaxrs.client.WebClient.fromClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。