本文整理汇总了Java中com.mashape.unirest.request.HttpRequest.queryString方法的典型用法代码示例。如果您正苦于以下问题:Java HttpRequest.queryString方法的具体用法?Java HttpRequest.queryString怎么用?Java HttpRequest.queryString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mashape.unirest.request.HttpRequest
的用法示例。
在下文中一共展示了HttpRequest.queryString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildQueryStringFromHeaders
import com.mashape.unirest.request.HttpRequest; //导入方法依赖的package包/类
private static HttpRequest buildQueryStringFromHeaders(
List<String> headers,
Object[] args,
int startAt,
HttpRequest request) {
if (headers.size() > 0) {
int i = startAt;
for (String header : headers) {
String headerValue = "";
if (args[i] != null) {
if (!isPrimitiveOrString(args[i].getClass())) {
headerValue = new UnirestJacksonObjectMapper().writeValue(args[i]);
} else {
headerValue = args[i].toString();
}
}
request = request.queryString(header, headerValue);
i++;
}
}
return request;
}
示例2: getServerInfo
import com.mashape.unirest.request.HttpRequest; //导入方法依赖的package包/类
public ServerInfo getServerInfo(Filter filter, Long minLastUpdate) {
try {
HttpRequest req = Unirest.get(url("/info"));
if (filter.getGameId() != null)
req.queryString("gameId", filter.getGameId());
if (filter.getMapId() != null)
req.queryString("mapId", filter.getMapId());
if (filter.getFlavorId() != null)
req.queryString("flavorId", filter.getFlavorId());
if (minLastUpdate != null)
req.queryString("minLastUpdate", minLastUpdate);
String body = req.asString().getBody();
ServerInfo serverInfo = GSON.fromJson(body, ServerInfo.class);
return serverInfo;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例3: getJoinableServer
import com.mashape.unirest.request.HttpRequest; //导入方法依赖的package包/类
public Server getJoinableServer(Filter filter, String uuid){
try {
HttpRequest req = Unirest.get(url("/joinable/{uuid}"))
.routeParam("uuid", uuid);
if (filter.getGameId() != null)
req.queryString("gameId", filter.getGameId());
if (filter.getMapId() != null)
req.queryString("mapId", filter.getMapId());
if (filter.getFlavorId() != null)
req.queryString("flavorId", filter.getFlavorId());
String body = req.asString().getBody();
Server server = GSON.fromJson(body, Server.class);
return server;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例4: formQueryRequest
import com.mashape.unirest.request.HttpRequest; //导入方法依赖的package包/类
protected HttpRequest formQueryRequest(String query, boolean includeObsoletes) {
HttpRequest req = Unirest.get(olsApiSearchUrl)
.queryString("q", query)
.queryString("fieldList", "iri");
if (includeObsoletes) {
req.queryString("obsoletes", "true");
}
return req;
}
示例5: retrieve
import com.mashape.unirest.request.HttpRequest; //导入方法依赖的package包/类
public JSONArray retrieve(Set<String> batchIds) throws UnirestException {
HttpRequest prequery = prebuild(RETRIEVE);
for (String batchId : batchIds) {
prequery = prequery.queryString("batch_id", batchId);
}
HttpResponse<JsonNode> response = prequery.asJson();
return response.getBody().getObject().getJSONArray("documents");
}