本文整理了Java中org.springframework.web.client.RestTemplate.delete
方法的一些代码示例,展示了RestTemplate.delete
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestTemplate.delete
方法的具体详情如下:
包路径:org.springframework.web.client.RestTemplate
类名称:RestTemplate
方法名:delete
暂无
代码示例来源:origin: codecentric/spring-boot-admin
public void deregister() {
String id = registeredId.get();
if (id != null) {
for (String adminUrl : client.getAdminUrl()) {
try {
template.delete(adminUrl + "/" + id);
registeredId.compareAndSet(id, null);
if (client.isRegisterOnce()) {
break;
}
} catch (Exception ex) {
LOGGER.warn("Failed to deregister application (id={}) at spring-boot-admin ({}): {}", id, adminUrl,
ex.getMessage());
}
}
}
}
代码示例来源: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 delete() throws Exception {
mockSentRequest(DELETE, "http://example.com");
mockResponseStatus(HttpStatus.OK);
template.delete("http://example.com");
verify(response).close();
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public void delete(String url, Map<String, ?> urlVariables) throws RestClientException {
getRestTemplate(url).delete(url, urlVariables);
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public void delete(URI url) throws RestClientException {
getRestTemplate(url).delete(url);
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public void delete(String url, Object... urlVariables) throws RestClientException {
getRestTemplate(url).delete(url, urlVariables);
}
代码示例来源:origin: org.springframework.boot/spring-boot-test
/**
* Delete the resources at the specified URI.
* <p>
* URI Template variables are expanded using the given URI variables, if any.
* @param url the URL
* @param urlVariables the variables to expand in the template
* @throws RestClientException on client-side HTTP error
* @see RestTemplate#delete(java.lang.String, java.lang.Object[])
*/
public void delete(String url, Object... urlVariables) throws RestClientException {
this.restTemplate.delete(url, urlVariables);
}
代码示例来源:origin: pl.edu.icm.synat/synat-platform-connector
protected void finishTransfer() throws IOException {
if (state != StreamingResourceState.TRANSFER_IN_PROGRESS && state != StreamingResourceState.EMPTY) {
throw new IOException("Streaming resource have to be in progress to be able to finish it");
}
try {
restTemplate.delete(uri);
} catch (RestClientException e) {
logger.info("Couldn't delete stream resource" + uri, e);
}
state = StreamingResourceState.TRANSFERED;
}
代码示例来源:origin: org.springframework.boot/spring-boot-test
/**
* Delete the resources at the specified URL.
* @param url the URL
* @throws RestClientException on client-side HTTP error
* @see RestTemplate#delete(java.net.URI)
*/
public void delete(URI url) throws RestClientException {
this.restTemplate.delete(applyRootUriIfNecessary(url));
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
private void doDeleteDomain(UUID domainGuid) {
Map<String, Object> urlVars = new HashMap<String, Object>();
String urlPath = "/v2/private_domains/{domain}";
urlVars.put("domain", domainGuid);
getRestTemplate().delete(getUrl(urlPath), urlVars);
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
private void unbindRoute(String host, UUID domainGuid, UUID appGuid) {
UUID routeGuid = getRouteGuid(host, domainGuid);
if (routeGuid != null) {
String bindPath = "/v2/apps/{app}/routes/{route}";
Map<String, Object> bindVars = new HashMap<String, Object>();
bindVars.put("app", appGuid);
bindVars.put("route", routeGuid);
getRestTemplate().delete(getUrl(bindPath), bindVars);
}
}
代码示例来源:origin: spring-cloud/spring-cloud-dataflow
@Override
public void unregister(String name, ApplicationType applicationType) {
String uri = appsLink.getHref() + "/{type}/{name}";
restTemplate.delete(uri, applicationType.name(), name);
}
代码示例来源:origin: spring-cloud/spring-cloud-dataflow
@Override
public void reset(String name) {
restTemplate.delete(links.getLink(FVC_RELATION).expand(name).getHref());
}
}
代码示例来源:origin: spring-cloud/spring-cloud-dataflow
@Override
public void reset(String name) {
restTemplate.delete(links.getLink(AGGREGATE_COUNTER_RELATION).expand(name).getHref());
}
}
代码示例来源:origin: spring-cloud/spring-cloud-dataflow
@Override
public void reset(String name) {
restTemplate.delete(links.getLink(COUNTER_RELATION).expand(name).getHref());
}
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
public void deleteQuota(String quotaName) {
CloudQuota quota = this.getQuotaByName(quotaName, true);
String setPath = "/v2/quota_definitions/{quotaGuid}";
Map<String, Object> setVars = new HashMap<String, Object>();
setVars.put("quotaGuid", quota.getMeta().getGuid());
getRestTemplate().delete(getUrl(setPath), setVars);
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
@Override
public void unbindStagingSecurityGroup(String securityGroupName) {
CloudSecurityGroup group = doGetSecurityGroup(securityGroupName, true);
Map<String, Object> urlVars = new HashMap<String, Object>();
String urlPath = "/v2/config/staging_security_groups/{guid}";
urlVars.put("guid", group.getMeta().getGuid());
getRestTemplate().delete(getUrl(urlPath), urlVars);
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
@Override
public void deleteSecurityGroup(String securityGroupName) {
CloudSecurityGroup group = doGetSecurityGroup(securityGroupName, true);
String path = "/v2/security_groups/{guid}";
Map<String, Object> pathVariables = new HashMap<String, Object>();
pathVariables.put("guid", group.getMeta().getGuid());
getRestTemplate().delete(getUrl(path), pathVariables);
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
@Override
public void unbindRunningSecurityGroup(String securityGroupName) {
CloudSecurityGroup group = doGetSecurityGroup(securityGroupName, true);
Map<String, Object> urlVars = new HashMap<String, Object>();
String urlPath = "/v2/config/running_security_groups/{guid}";
urlVars.put("guid", group.getMeta().getGuid());
getRestTemplate().delete(getUrl(urlPath), urlVars);
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
@Override
public void deleteServiceBroker(String name) {
CloudServiceBroker existingBroker = getServiceBroker(name);
Assert.notNull(existingBroker, "Cannot update broker if it does not first exist");
getRestTemplate().delete(getUrl("/v2/service_brokers/{guid}"), existingBroker.getMeta().getGuid());
}
内容来源于网络,如有侵权,请联系作者删除!