本文整理了Java中com.mashape.unirest.request.HttpRequest.queryString()
方法的一些代码示例,展示了HttpRequest.queryString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.queryString()
方法的具体详情如下:
包路径:com.mashape.unirest.request.HttpRequest
类名称:HttpRequest
方法名:queryString
暂无
代码示例来源:origin: Kong/unirest-java
public HttpRequest queryString(String name, Collection<?> value) {
for (Object cur : value) {
queryString(name, cur);
}
return this;
}
代码示例来源:origin: Kong/unirest-java
@Override
public HttpRequestWithBody queryString(Map<String, Object> parameters) {
return (HttpRequestWithBody) super.queryString(parameters);
}
代码示例来源:origin: Kong/unirest-java
@Override
public HttpRequestWithBody queryString(String name, Object value) {
return (HttpRequestWithBody) super.queryString(name, value);
}
代码示例来源:origin: Kong/unirest-java
public HttpRequest queryString(Map<String, Object> parameters) {
if (parameters != null) {
for (Entry<String, Object> param : parameters.entrySet()) {
if (param.getValue() instanceof String || param.getValue() instanceof Number || param.getValue() instanceof Boolean) {
queryString(param.getKey(), param.getValue());
} else {
throw new RuntimeException("Parameter \"" + param.getKey() + "\" can't be sent with a GET request because of type: " + param.getValue().getClass().getName());
}
}
}
return this;
}
代码示例来源:origin: com.mashape.unirest/unirest-java
public HttpRequest queryString(String name, Collection<?> value) {
for (Object cur : value) {
queryString(name, cur);
}
return this;
}
代码示例来源:origin: com.github.bingoohuang/unirest-java
@Override
public HttpRequestWithBody queryString(String name, Object value) {
return (HttpRequestWithBody) super.queryString(name, value);
}
代码示例来源:origin: com.github.bingoohuang/unirest-java
public HttpRequest queryString(String name, Collection<?> value) {
for (Object cur : value) {
queryString(name, cur);
}
return this;
}
代码示例来源:origin: com.mashape.unirest/unirest-java
@Override
public HttpRequestWithBody queryString(String name, Object value) {
return (HttpRequestWithBody) super.queryString(name, value);
}
代码示例来源:origin: com.mashape.unirest/unirest-java
@Override
public HttpRequestWithBody queryString(Map<String, Object> parameters) {
return (HttpRequestWithBody) super.queryString(parameters);
}
代码示例来源:origin: com.github.bingoohuang/unirest-java
@Override
public HttpRequestWithBody queryString(Map<String, Object> parameters) {
return (HttpRequestWithBody) super.queryString(parameters);
}
代码示例来源:origin: vulnersCom/burp-vulners-scanner
.routeParam("path", "software")
.queryString("software", software.getAlias())
.queryString("version", software.getVersion())
.queryString("type", software.getMatchType());
代码示例来源:origin: com.github.bingoohuang/unirest-java
public HttpRequest queryString(Map<String, Object> parameters) {
if (parameters != null) {
for (Entry<String, Object> param : parameters.entrySet()) {
// if (param.getValue() instanceof String || param.getValue() instanceof Number || param.getValue() instanceof Boolean) {
queryString(param.getKey(), param.getValue());
// } else {
// throw new RuntimeException("Parameter \"" + param.getKey() + "\" can't be sent with a GET request because of type: " + param.getValue().getClass().getName());
// }
}
}
return this;
}
代码示例来源:origin: com.mashape.unirest/unirest-java
public HttpRequest queryString(Map<String, Object> parameters) {
if (parameters != null) {
for (Entry<String, Object> param : parameters.entrySet()) {
if (param.getValue() instanceof String || param.getValue() instanceof Number || param.getValue() instanceof Boolean) {
queryString(param.getKey(), param.getValue());
} else {
throw new RuntimeException("Parameter \"" + param.getKey() + "\" can't be sent with a GET request because of type: " + param.getValue().getClass().getName());
}
}
}
return this;
}
代码示例来源:origin: forcelate/forcelate-benchmarks
@Override
public void trades() throws IOException, UnirestException {
HttpResponse<String> response = Unirest.get(POLONIEX_BASE_URL)
.queryString(COMMAND_QUERY_KEY, "returnTradeHistory")
.queryString("currencyPair", "BTC_NXT")
.queryString("start", "1410158341")
.queryString("end", "1410158341")
.asString();
unirestParamsClient.trades(response, POLONIEX);
}
}
代码示例来源:origin: forcelate/forcelate-benchmarks
@Override
public void orderBook() throws IOException, UnirestException {
HttpResponse<String> response = Unirest.get(POLONIEX_BASE_URL)
.queryString(COMMAND_QUERY_KEY, "returnOrderBook")
.queryString("currencyPair", "all")
.queryString("depth", "100")
.asString();
unirestParamsClient.orderBook(response, POLONIEX);
}
代码示例来源:origin: com.infotel.seleniumRobot/core
@Override
public void startVideoCapture() {
if (nodeUrl == null) {
throw new ScenarioException("You cannot start video capture before driver has been created and corresponding node instanciated");
}
logger.info("starting capture");
try {
Unirest.get(String.format("%s%s", nodeUrl, NODE_TASK_SERVLET))
.queryString("action", "startVideoCapture")
.queryString("session", sessionId).asString();
} catch (UnirestException e) {
logger.warn(String.format("Could start video capture: %s", e.getMessage()));
}
}
代码示例来源:origin: DiUS/pact-workshop-jvm
private Optional<JsonNode> loadProviderJson(String dateTime) throws UnirestException {
HttpRequest getRequest = Unirest.get(url + "/provider.json");
if (StringUtils.isNoneEmpty(dateTime)) {
getRequest = getRequest.queryString("validDate", dateTime);
}
HttpResponse<JsonNode> jsonNodeHttpResponse = getRequest.asJson();
if (jsonNodeHttpResponse.getStatus() == 200) {
return Optional.of(jsonNodeHttpResponse.getBody());
} else {
return Optional.empty();
}
}
代码示例来源:origin: forcelate/forcelate-benchmarks
@Override
public void orderBook() throws IOException, UnirestException {
HttpResponse<String> response = Unirest.get(ORDER_BOOK_URL)
.queryString(PAIR_QUERY_KEY, PAIR_QUERY_VALUE)
.queryString("count", "100")
.asString();
unirestParamsClient.orderBook(response, KRAKEN);
}
代码示例来源:origin: simplesteph/medium-blog-kafka-udemy
public ReviewApiResponse reviewApi(Integer pageSize, Integer page) throws HttpException {
String url = "https://www.udemy.com/api-2.0/courses/" + courseId + "/reviews";
HttpResponse<JsonNode> jsonResponse = null;
try {
jsonResponse = Unirest.get(url)
.queryString("page", page)
.queryString("page_size", pageSize)
.queryString("fields[course_review]", "title,content,rating,created,modified,user_modified,user,course")
.asJson();
} catch (UnirestException e) {
throw new HttpException(e.getMessage());
}
if (jsonResponse.getStatus() == 200) {
JSONObject body = jsonResponse.getBody().getObject();
Integer count = body.getInt("count");
String next = body.optString("next");
String previous = body.optString("previous");
List<Review> reviews = this.convertResults(body.getJSONArray("results"));
ReviewApiResponse reviewApiResponse = new ReviewApiResponse(count, next, previous, reviews);
return reviewApiResponse;
}
throw new HttpException("Udemy API Unavailable");
}
代码示例来源:origin: CognitiveJ/cognitivej
private T doWork() {
try {
setupErrorHandlers();
WorkingContext workingContext = workingContext();
HttpRequest builtRequest = buildUnirest(workingContext)
.queryString(workingContext.getQueryParams())
.headers(workingContext.getHeaders()).header("Ocp-Apim-Subscription-Key", cognitiveContext.subscriptionKey);
if (!workingContext.getHttpMethod().equals(HttpMethod.GET) && workingContext().getPayload().size() > 0) {
buildBody((HttpRequestWithBody) builtRequest);
}
HttpResponse response;
if (typedResponse() == InputStream.class)
response = builtRequest.asBinary();
else
response = builtRequest.asString();
checkForError(response);
return postProcess(typeResponse(response.getBody()));
} catch (UnirestException | IOException e) {
throw new CognitiveException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!