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


Java HttpRequest.queryString方法代码示例

本文整理汇总了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;
}
 
开发者ID:drinkwater-io,项目名称:drinkwater-java,代码行数:23,代码来源:Rest.java

示例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;
    }
}
 
开发者ID:Exorath,项目名称:ConnectorService,代码行数:20,代码来源:ConnectorServiceAPI.java

示例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;
    }
}
 
开发者ID:Exorath,项目名称:ConnectorService,代码行数:19,代码来源:ConnectorServiceAPI.java

示例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;
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:12,代码来源:OlsSearchServiceImpl.java

示例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");
}
 
开发者ID:textocat,项目名称:textocat-java-sdk,代码行数:9,代码来源:EntityHttpService.java


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