本文整理了Java中com.mashape.unirest.http.Unirest.put()
方法的一些代码示例,展示了Unirest.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unirest.put()
方法的具体详情如下:
包路径:com.mashape.unirest.http.Unirest
类名称:Unirest
方法名:put
暂无
代码示例来源:origin: lets-blade/blade
protected HttpRequest put(String path) {
log.info("[PUT] {}", (origin + path));
return Unirest.put(origin + path);
}
代码示例来源:origin: lets-blade/blade
protected String putBodyString(String path) throws Exception {
log.info("[PUT] {}", (origin + path));
return Unirest.put(origin + path).asString().getBody();
}
代码示例来源:origin: io.joshworks/snappy-core
public static HttpRequestWithBody put(String url) {
return Unirest.put(url);
}
代码示例来源:origin: io.joshworks/snappy
public static HttpRequestWithBody put(String url) {
return Unirest.put(ClientManager.lookup(url));
}
代码示例来源:origin: net.dv8tion/JDA
public JSONObject put(String url, JSONObject body)
{
return toObject(addHeaders(Unirest.put(url)).body(body.toString()));
}
代码示例来源:origin: streampipes/streampipes-ce
private static int registerServiceHttpClient(String body) throws UnirestException {
HttpResponse<JsonNode> jsonResponse = Unirest.put(consulURL().toString() + "/" + CONSUL_URL_REGISTER_SERVICE)
.header("accept", "application/json")
.body(body)
.asJson();
return jsonResponse.getStatus();
}
代码示例来源:origin: CognitiveJ/cognitivej
private HttpRequest buildUnirest(WorkingContext workingContext) {
String url = String.format("%s%s", PROJECTOXFORD_AI, workingContext.getPathBuilt());
switch (workingContext.getHttpMethod()) {
case GET:
return Unirest.get(url);
case PUT:
return Unirest.put(url);
case DELETE:
return Unirest.delete(url);
case PATCH:
return Unirest.patch(url);
}
return Unirest.post(url);
}
代码示例来源:origin: unipop-graph/unipop
private BaseRequest executePut(String baseUrl, Object urlMap, Object bodyMap) {
return Unirest.put(baseUrl + urlTemplate.execute(urlMap)).header("Content-type", "application/json").body(bodyTemplate.execute(bodyMap));
}
代码示例来源:origin: com.infotel.seleniumRobot/core
checkoutEntity("run", currentRunId);
HttpResponse<String> response = Unirest.put(serverUrl + "/rest/domains/{domain}/projects/{project}/runs/{runId}")
.routeParam("runId", currentRunId)
.routeParam(PROJECT_NAME, project)
代码示例来源:origin: Apicurio/apicurio-studio
.toString();
HttpRequestWithBody request = Unirest.put(createContentUrl).header("Content-Type", "application/json; charset=utf-8");
addSecurityTo(request);
HttpResponse<JsonNode> response = request.body(requestBody).asJson();
代码示例来源:origin: Kong/Astronode-Broadcaster
break;
case PUT:
response = Unirest.put(url).fields(parameters).asJson();
break;
case PATCH:
代码示例来源:origin: Apicurio/apicurio-studio
/**
* @see io.apicurio.hub.api.connectors.ISourceConnector#createResourceContent(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public void createResourceContent(String repositoryUrl, String commitMessage, String content) throws SourceConnectorException {
try {
String b64Content = Base64.encodeBase64String(content.getBytes(StandardCharsets.UTF_8));
GitHubResource resource = GitHubResourceResolver.resolve(repositoryUrl);
GitHubCreateFileRequest requestBody = new GitHubCreateFileRequest();
requestBody.setMessage(commitMessage);
requestBody.setContent(b64Content);
requestBody.setBranch(resource.getBranch());
String createContentUrl = this.endpoint("/repos/:org/:repo/contents/:path")
.bind("org", resource.getOrganization())
.bind("repo", resource.getRepository())
.bind("path", resource.getResourcePath())
.toString();
HttpRequestWithBody request = Unirest.put(createContentUrl).header("Content-Type", "application/json; charset=utf-8");
addSecurityTo(request);
HttpResponse<InputStream> response = request.body(requestBody).asBinary();
if (response.getStatus() != 201) {
throw new UnirestException("Unexpected response from GitHub: " + response.getStatus() + "::" + response.getStatusText());
}
} catch (UnirestException e) {
logger.error("Error creating Github resource content.", e);
throw new SourceConnectorException("Error creating Github resource content.", e);
}
}
代码示例来源:origin: discord-java/discord.jar
break;
case PUT:
request = Unirest.put(url);
break;
case GET:
代码示例来源:origin: kevoree/kevoree
default HttpResponse<RDeployUnit> updateDu(RDeployUnit du) throws UnirestException, KevoreeRegistryException {
// be sure user is logged-in / refresh token if necessary / throws otherwise
this.ensureLogin();
// PUT du
return Unirest.put(this.baseUrl() + "/api/namespaces/{namespace}/tdefs/{tdefName}/{tdefVersion}/dus/{name}/{version}/{platform}")
.header("Authorization", "Bearer " + config().getString("user.access_token"))
.header("Content-Type", "application/json")
.routeParam("namespace", du.getNamespace())
.routeParam("tdefName", du.getTdefName())
.routeParam("tdefVersion", du.getTdefVersion().toString())
.routeParam("name", du.getName())
.routeParam("version", du.getVersion())
.routeParam("platform", du.getPlatform())
.body(du)
.asObject(RDeployUnit.class);
}
内容来源于网络,如有侵权,请联系作者删除!