本文整理汇总了Java中org.apache.cxf.jaxrs.client.WebClient.get方法的典型用法代码示例。如果您正苦于以下问题:Java WebClient.get方法的具体用法?Java WebClient.get怎么用?Java WebClient.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.jaxrs.client.WebClient
的用法示例。
在下文中一共展示了WebClient.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readGroupMembers
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
private GroupMembership readGroupMembers(String groupKey, GroupMembership parent) throws ResourceNotFoundException {
String path = MessageFormat.format("groups/{0}/members", new Object[]{groupKey});
WebClient webClient = WebClient.fromClient(directoryApiClient, true).path(path);
ClientAccessToken accessToken = tokenCache.get();
webClient.authorization(accessToken);
GroupMembership result;
try {
if (parent != null && parent.getNextPageToken() != null) {
result = webClient.query("pageToken", parent.getNextPageToken()).get(GroupMembership.class);
result.getMembers().addAll(parent.getMembers());
} else {
result = webClient.get(GroupMembership.class);
}
return result.getNextPageToken() != null ? readGroupMembers(groupKey, result) : result;
} catch (NotFoundException e) {
throw new ResourceNotFoundException("Group " + groupKey + " not found.", e);
}
}
示例2: doGet
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
String doGet(String api, Prameters prams){
WebClient wc = WebClient.create(api);
wc.query(ACCESS_TOKEN, access_token());
String[] keys = prams.keys;
for(int i = 0 ; i < keys.length ; i ++){
wc.query(keys[i], prams.value(i));
}
Response resp = wc.get();
String result = "";
try {
result = IOUtils.toString((InputStream) resp.getEntity());
} catch (IOException e) {
throw new ParseResultException(e);
}
handleResponse(resp, wc);
return result;
}
示例3: testHomeXML
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testHomeXML() {
if (!waitForWADL()) {
return;
}
WebClient client = WebClient.create(ENDPOINT_ADDRESS);
client.header("Authorization", "Basic YWRtaW46YWRtaW4=");
client.type("application/xml");
client.accept("application/xml");
client.path("home");
String response = readReource("xml/response-home.xml");
String webRespose = client.get(String.class);
assertEquals(response, webRespose);
}
示例4: test001getUserSelfBySomebody
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void test001getUserSelfBySomebody() {
final String TEST_NAME = "test001getUserSelfBySomebody";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_SOMEBODY_OID);
client.path("/self/");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 200);
UserType userType = response.readEntity(UserType.class);
assertNotNull("Returned entity in body must not be null.", userType);
LOGGER.info("Returned entity: {}", userType.asPrismObject().debugDump());
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
示例5: getResourceHostMetrics
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
public ResourceHostMetrics getResourceHostMetrics() throws PeerException
{
WebClient client = null;
Response response;
try
{
remotePeer.checkRelation();
String path = "/resources";
client = WebClientBuilder.buildPeerWebClient( peerInfo, path, provider );
client.type( MediaType.APPLICATION_JSON );
client.accept( MediaType.APPLICATION_JSON );
response = client.get();
}
catch ( Exception e )
{
LOG.error( e.getMessage(), e );
throw new PeerException( String.format( "Error getting rh metrics: %s", e.getMessage() ) );
}
finally
{
WebClientBuilder.close( client );
}
return WebClientBuilder.checkResponse( response, ResourceHostMetrics.class );
}
示例6: getResourceLimits
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
public PeerResources getResourceLimits( final PeerId peerId ) throws PeerException
{
WebClient client = null;
Response response;
try
{
remotePeer.checkRelation();
String path = String.format( "/limits/%s", peerId.getId() );
client = WebClientBuilder.buildPeerWebClient( peerInfo, path, provider, 3000, 15000, 1 );
client.accept( MediaType.APPLICATION_JSON );
response = client.get();
}
catch ( Exception e )
{
LOG.error( e.getMessage(), e );
throw new PeerException( String.format( "Error on retrieving peer limits: %s", e.getMessage() ) );
}
finally
{
WebClientBuilder.close( client );
}
return WebClientBuilder.checkResponse( response, PeerResources.class );
}
示例7: test003getUserAdministratorByEgoist
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
/**
* egoist doesn't have authorization to read other object. ot has only end user role,
* so he is allowed to performed defined actions on his own.
*/
@Test
public void test003getUserAdministratorByEgoist() {
final String TEST_NAME = "test003getUserAdministratorByEgoist";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_EGOIST_OID);
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 403);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
示例8: test016GetAuthBadPassword
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void test016GetAuthBadPassword() {
final String TEST_NAME = "test016GetAuthBadPassword";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_ADMINISTRATOR_USERNAME, "forgot");
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 401);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(1);
getDummyAuditService().assertFailedLogin(SchemaConstants.CHANNEL_REST_URI);
}
示例9: test018GetUserAdministratorByCyclops
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void test018GetUserAdministratorByCyclops() {
final String TEST_NAME = "test018GetUserAdministratorByCyclops";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_CYCLOPS_USERNAME, USER_CYCLOPS_PASSWORD);
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 403);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
示例10: test131GetUserAdministratorByDarthAdder
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void test131GetUserAdministratorByDarthAdder() {
final String TEST_NAME = "test131GetUserAdministratorByDarthAdder";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD);
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 403);
assertNoEmptyResponse(response);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(1);
getDummyAuditService().assertFailedLogin(SchemaConstants.CHANNEL_REST_URI);
}
示例11: test133GetUserAdministratorByDarthAdder
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void test133GetUserAdministratorByDarthAdder() {
final String TEST_NAME = "test133GetUserAdministratorByDarthAdder";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD);
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.get();
TestUtil.displayThen(TEST_NAME);
assertStatus(response, 200);
UserType userType = response.readEntity(UserType.class);
assertNotNull("Returned entity in body must not be null.", userType);
LOGGER.info("Returned entity: {}", userType.asPrismObject().debugDump());
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(2);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
}
示例12: getTemplateDownloadProgress
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
public PeerTemplatesDownloadProgress getTemplateDownloadProgress( final EnvironmentId environmentId )
throws PeerException
{
WebClient client = null;
Response response;
try
{
String path = String.format( "/%s/templatesprogress", environmentId.getId() );
client = WebClientBuilder.buildEnvironmentWebClient( peerInfo, path, provider );
response = client.get();
}
catch ( Exception e )
{
LOG.error( e.getMessage(), e );
throw new PeerException( "Error obtaining template download progress: " + e.getMessage() );
}
finally
{
WebClientBuilder.close( client );
}
return WebClientBuilder.checkResponse( response, PeerTemplatesDownloadProgress.class );
}
示例13: readAllUsers
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
private GSuiteUsers readAllUsers(GSuiteUsers parent) {
WebClient webClient = WebClient.fromClient(directoryApiClient, true).path("users");
ClientAccessToken accessToken = tokenCache.get();
webClient.authorization(accessToken);
GSuiteUsers result;
webClient.query("domain", config.getGSuiteDomain());
if (parent != null && parent.getNextPageToken() != null) {
result = webClient.query("pageToken", parent.getNextPageToken()).get(GSuiteUsers.class);
result.getUsers().addAll(parent.getUsers());
} else {
result = webClient.get(GSuiteUsers.class);
}
return result.getNextPageToken() != null ? readAllUsers(result) : result;
}
示例14: getUserAdministrator
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
private Response getUserAdministrator(String authorizationHeader){
WebClient client = WebClient.create(ENDPOINT_ADDRESS);
client.authorization(authorizationHeader);
client.path("/users/" + SystemObjectsType.USER_ADMINISTRATOR.value());
Response response = client.get();
return response;
}
示例15: getInfo
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
public PeerInfo getInfo() throws PeerException
{
WebClient client = null;
Response response;
try
{
remotePeer.checkRelation();
String path = "/info";
client = WebClientBuilder.buildPeerWebClient( peerInfo, path, provider, 3000, 15000, 1 );
client.type( MediaType.APPLICATION_JSON );
client.accept( MediaType.APPLICATION_JSON );
response = client.get();
}
catch ( Exception e )
{
LOG.error( e.getMessage(), e );
throw new PeerException( String.format( "Error getting peer info: %s", e.getMessage() ) );
}
finally
{
WebClientBuilder.close( client );
}
return WebClientBuilder.checkResponse( response, PeerInfo.class );
}