本文整理汇总了Java中org.apache.cxf.jaxrs.client.WebClient.query方法的典型用法代码示例。如果您正苦于以下问题:Java WebClient.query方法的具体用法?Java WebClient.query怎么用?Java WebClient.query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.jaxrs.client.WebClient
的用法示例。
在下文中一共展示了WebClient.query方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: setupClientQueryAndHeaders
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void setupClientQueryAndHeaders(WebClient client, Exchange exchange) throws Exception {
Message inMessage = exchange.getIn();
CxfRsEndpoint cxfRsEndpoint = (CxfRsEndpoint) getEndpoint();
// check if there is a query map in the message header
Map<String, String> maps = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_QUERY_MAP, Map.class);
if (maps == null) {
// Get the map from HTTP_QUERY header
String queryString = inMessage.getHeader(Exchange.HTTP_QUERY, String.class);
if (queryString != null) {
maps = getQueryParametersFromQueryString(queryString,
IOHelper.getCharsetName(exchange));
}
}
if (maps == null) {
maps = cxfRsEndpoint.getParameters();
}
if (maps != null) {
for (Map.Entry<String, String> entry : maps.entrySet()) {
client.query(entry.getKey(), entry.getValue());
}
}
setupClientHeaders(client, exchange);
}
示例3: getGroups
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Override
public GroupList getGroups(String userKey) {
WebClient webClient = WebClient.fromClient(directoryApiClient, true).path("groups");
webClient.authorization(tokenCache.get());
if (userKey != null) {
webClient.query("userKey", userKey);
}
GroupList groupList = webClient.query("domain", config.getGSuiteDomain()).get(GroupList.class);
return groupList;
}
示例4: 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;
}
示例5: testQueryURL
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void testQueryURL() {
WebClient wc = WebClient.create("https://api.weibo.com/2/friendships/followers.json");
wc.query(ACCESS_TOKEN, decode("-52ed5042b10eedc1d7c14267f5305ab1246d26e6405eb467b366fb607de848e5b731ea06889a5c61"));
wc.query(UID, "5957842765");
System.out.println(wc.getCurrentURI());
}
示例6: test104AddAccountRawResourceDoesNotExist
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void test104AddAccountRawResourceDoesNotExist() throws Exception {
final String TEST_NAME = "test104AddAccountRaw";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/shadows");
client.query("options", "raw");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(getRepoFile(ACCOUT_CHUCK_FILE));
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
// expecting hadnled error because resource doesn't exist.. it is OK, but let's say admin about that
assertStatus(response, 240);
OperationResult addResult = traceResponse(response);
assertNotNull("Expected operation result in the response, but nothing in the body", addResult);
assertEquals("Unexpected status of the operation result. Expected "+ OperationResultStatus.HANDLED_ERROR + ", but was " + addResult.getStatus(), addResult.getStatus(), OperationResultStatus.HANDLED_ERROR);
OperationResult parentResult = new OperationResult("get");
try {
getProvisioning().getObject(ShadowType.class, ACCOUT_CHUCK_OID,
SelectorOptions.createCollection(GetOperationOptions.createDoNotDiscovery()), null,
parentResult);
fail("expected object not found exception but haven't got one.");
} catch (ObjectNotFoundException ex) {
// this is OK..we expect objet not found, because accout was added
// with the raw options which indicates, that it was created only in
// the repository
}
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(4);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
getDummyAuditService().assertHasDelta(1, ChangeType.ADD, ShadowType.class);
}
示例7: test401AddUserTemplateOverwrite
import org.apache.cxf.jaxrs.client.WebClient; //导入方法依赖的package包/类
@Test
public void test401AddUserTemplateOverwrite() throws Exception {
final String TEST_NAME = "test401AddUserTemplateOverwrite";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/objectTemplates");
client.query("options", "overwrite");
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(getRepoFile(USER_TEMPLATE_FILE));
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertEquals("Expected 201 but got " + response.getStatus(), 201, response.getStatus());
String location = response.getHeaderString("Location");
String expected = ENDPOINT_ADDRESS + "/objectTemplates/" + USER_TEMPLATE_OID;
assertEquals("Unexpected location, expected: " + expected + " but was " + location,
expected,
location);
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(4);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
getDummyAuditService().assertHasDelta(1, ChangeType.ADD, ObjectTemplateType.class);
}