本文整理了Java中org.springframework.web.client.RestTemplate.put
方法的一些代码示例,展示了RestTemplate.put
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestTemplate.put
方法的具体详情如下:
包路径:org.springframework.web.client.RestTemplate
类名称:RestTemplate
方法名:put
暂无
代码示例来源:origin: cloudfoundry/uaa
private void registerNotifications() {
HashMap<String, Object> request = new HashMap<>();
request.put("source_description", "CF_Identity");
request.put("kinds", notifications.values());
notificationsTemplate.put(notificationsUrl + "/registration", request);
isNotificationsRegistered = true;
}
}
代码示例来源:origin: spring-projects/spring-framework
private void executeAndVerify() throws URISyntaxException {
this.restTemplate.put(new URI("/composers"), this.people);
this.mockServer.verify();
}
代码示例来源:origin: spring-projects/spring-framework
private void executeAndVerify(Object body) throws URISyntaxException {
this.restTemplate.put(new URI("/foo"), body);
this.mockServer.verify();
}
代码示例来源:origin: spring-projects/spring-framework
private void executeAndVerify() throws URISyntaxException {
this.restTemplate.put(new URI("/composers"), this.people);
this.mockServer.verify();
}
代码示例来源:origin: spring-projects/spring-framework
private void executeAndVerify() throws URISyntaxException {
this.restTemplate.put(new URI("/composers"), people);
this.mockServer.verify();
}
代码示例来源:origin: ctripcorp/apollo
private <T> T doExecute(HttpMethod method, ServiceDTO service, String path, Object request,
Class<T> responseType,
Object... uriVariables) {
T result = null;
switch (method) {
case GET:
result = restTemplate.getForObject(parseHost(service) + path, responseType, uriVariables);
break;
case POST:
result =
restTemplate.postForEntity(parseHost(service) + path, request, responseType, uriVariables).getBody();
break;
case PUT:
restTemplate.put(parseHost(service) + path, request, uriVariables);
break;
case DELETE:
restTemplate.delete(parseHost(service) + path, uriVariables);
break;
default:
throw new UnsupportedOperationException(String.format("unsupported http method(method=%s)", method));
}
return result;
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void putNull() throws Exception {
HttpHeaders requestHeaders = new HttpHeaders();
mockSentRequest(PUT, "http://example.com", requestHeaders);
mockResponseStatus(HttpStatus.OK);
template.put("http://example.com", null);
assertEquals("Invalid content length", 0, requestHeaders.getContentLength());
verify(response).close();
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void put() throws Exception {
mockTextPlainHttpMessageConverter();
mockSentRequest(PUT, "http://example.com");
mockResponseStatus(HttpStatus.OK);
template.put("http://example.com", "Hello World");
verify(response).close();
}
代码示例来源:origin: cloudfoundry/uaa
public static ScimGroup createOrUpdateGroup(RestTemplate client,
String url,
ScimGroup scimGroup) {
//dont modify the actual argument
LinkedList<ScimGroupMember> members = new LinkedList<>(scimGroup.getMembers());
ScimGroup existing = getGroup(client, url, scimGroup.getDisplayName());
if (existing != null) {
members.addAll(existing.getMembers());
}
scimGroup.setMembers(members);
if (existing != null) {
scimGroup.setId(existing.getId());
client.put(url + "/Groups/{id}", scimGroup, scimGroup.getId());
return scimGroup;
} else {
ResponseEntity<String> group = client.postForEntity(url + "/Groups", scimGroup, String.class);
if (group.getStatusCode() == HttpStatus.CREATED) {
return JsonUtils.readValue(group.getBody(), ScimGroup.class);
} else {
throw new IllegalStateException("Invalid return code:" + group.getStatusCode());
}
}
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public void put(String url, Object request, Object... urlVariables) throws RestClientException {
getRestTemplate(url).put(url, request, urlVariables);
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public void put(URI url, Object request) throws RestClientException {
getRestTemplate(url).put(url, request);
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public void put(String url, Object request, Map<String, ?> urlVariables) throws RestClientException {
getRestTemplate(url).put(url, request, urlVariables);
}
代码示例来源:origin: org.motechproject/motech-http-agent
@Override
public void execute(RestTemplate restTemplate, String url, Object request) {
restTemplate.put(url, request);
}
},
代码示例来源:origin: spring-cloud/spring-cloud-dataflow
@Override
public void makeDefault(String name, ApplicationType type, String version) {
restTemplate.put(appsLink.getHref() + "/{type}/{name}/{version}", null, type, name, version);
}
}
代码示例来源:origin: com.sap.cloud.lm.sl/cloudfoundry-client-lib
private void doSetQuotaToOrg(UUID orgGuid, UUID quotaGuid) {
String setPath = "/v2/organizations/{org}";
Map<String, Object> setVars = new HashMap<String, Object>();
setVars.put("org", orgGuid);
HashMap<String, Object> setRequest = new HashMap<String, Object>();
setRequest.put("quota_definition_guid", quotaGuid);
getRestTemplate().put(getUrl(setPath), setRequest, setVars);
}
代码示例来源:origin: com.sap.cloud.lm.sl/cloudfoundry-client-lib
private void doUpdateSecurityGroup(CloudSecurityGroup currentGroup, String name, List<Map<String, Object>> rules) {
String path = "/v2/security_groups/{guid}";
Map<String, Object> pathVariables = new HashMap<String, Object>();
pathVariables.put("guid", currentGroup.getMeta()
.getGuid());
HashMap<String, Object> request = new HashMap<String, Object>();
request.put("name", name);
request.put("rules", rules);
// Updates of bindings to spaces and default staging/running groups must be done
// through explicit calls to those methods and not through this generic update
getRestTemplate().put(getUrl(path), request, pathVariables);
}
代码示例来源:origin: com.sap.cloud.lm.sl/cloudfoundry-client-lib
@Override
public void updateApplicationMemory(String appName, int memory) {
UUID appId = getApplicationId(appName);
HashMap<String, Object> appRequest = new HashMap<String, Object>();
appRequest.put("memory", memory);
getRestTemplate().put(getUrl("/v2/apps/{guid}"), appRequest, appId);
}
代码示例来源:origin: de.adorsys.aspsp/xs2a-impl
public void updateAspspConsentData(AspspConsentData consentData) {
Optional.ofNullable(consentData)
.filter(cd -> StringUtils.isNotBlank(cd.getConsentId()) && Objects.nonNull(cd.getAspspConsentData()))
.ifPresent(cd -> {
String aspspConsentDataBase64 = Optional.ofNullable(cd.getAspspConsentData())
.map(bytes -> Base64.getEncoder().encodeToString(bytes))
.orElse(null);
consentRestTemplate.put(getRemoteUrl().updateAspspConsentData(), new Xs2aConsentData(cd.getConsentId(), aspspConsentDataBase64), cd.getConsentId());
});
}
代码示例来源:origin: com.sap.cloud.lm.sl/cloudfoundry-client-lib
@Override
public void updateApplicationStaging(String appName, Staging staging) {
UUID appId = getApplicationId(appName);
HashMap<String, Object> appRequest = new HashMap<String, Object>();
addStagingToRequest(staging, appRequest);
getRestTemplate().put(getUrl("/v2/apps/{guid}"), appRequest, appId);
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
@Override
public void stopApplication(String appName) {
CloudApplication app = getApplication(appName);
if (app.getState() != CloudApplication.AppState.STOPPED) {
HashMap<String, Object> appRequest = new HashMap<String, Object>();
appRequest.put("state", CloudApplication.AppState.STOPPED);
getRestTemplate().put(getUrl("/v2/apps/{guid}"), appRequest, app.getMeta().getGuid());
}
}
内容来源于网络,如有侵权,请联系作者删除!