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


Java WebClient.get方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:hlavki,项目名称:g-suite-identity-sync,代码行数:20,代码来源:GSuiteDirectoryServiceImpl.java

示例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;
}
 
开发者ID:kylinsoong,项目名称:weibo4j,代码行数:18,代码来源:Weibo.java

示例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);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:TestService.java

示例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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:24,代码来源:TestRestServiceProxyAuthentication.java

示例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 );
}
 
开发者ID:subutai-io,项目名称:base,代码行数:27,代码来源:PeerWebClient.java

示例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 );
}
 
开发者ID:subutai-io,项目名称:base,代码行数:27,代码来源:PeerWebClient.java

示例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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:25,代码来源:TestRestServiceProxyAuthentication.java

示例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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:21,代码来源:TestAbstractRestService.java

示例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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:21,代码来源:TestAbstractRestService.java

示例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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:22,代码来源:TestAbstractRestService.java

示例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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:24,代码来源:TestAbstractRestService.java

示例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 );
}
 
开发者ID:subutai-io,项目名称:base,代码行数:26,代码来源:EnvironmentWebClient.java

示例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;
}
 
开发者ID:hlavki,项目名称:g-suite-identity-sync,代码行数:15,代码来源:GSuiteDirectoryServiceImpl.java

示例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;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:9,代码来源:TestSecurityQuestionChallengeResponse.java

示例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 );
}
 
开发者ID:subutai-io,项目名称:base,代码行数:30,代码来源:PeerWebClient.java


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