Example usage for org.springframework.http HttpMethod DELETE

List of usage examples for org.springframework.http HttpMethod DELETE

Introduction

In this page you can find the example usage for org.springframework.http HttpMethod DELETE.

Prototype

HttpMethod DELETE

To view the source code for org.springframework.http HttpMethod DELETE.

Click Source Link

Usage

From source file:org.springframework.cloud.netflix.zuul.filters.route.support.ZuulProxyTestBase.java

@Test
public void ribbonDeleteWithBody() {
    this.endpoint.reset();
    ResponseEntity<String> result = new TestRestTemplate().exchange(
            "http://localhost:" + this.port + "/simple/deletewithbody", HttpMethod.DELETE,
            new HttpEntity<>("deleterequestbody"), String.class);
    assertEquals(HttpStatus.OK, result.getStatusCode());
    if (supportsDeleteWithBody()) {
        assertEquals("Deleted deleterequestbody", result.getBody());
    } else {/*from w  w w  . j a v a  2  s.  c  o  m*/
        assertEquals("Deleted null", result.getBody());
    }
}

From source file:org.springframework.data.hadoop.admin.cli.commands.BaseCommand.java

/**
 * call rest service with "Delete" //w  ww . j  a v a2  s. c  om
 * @param object
 */
public <T> void callDeleteService(T object) {
    try {
        RestTemplate template = getRestTemplate();
        //template.delete(getCommandUrl());
        HttpEntity<T> entity = new HttpEntity<T>(object);
        ResponseEntity<String> response = template.exchange(generateCommandUrl(), HttpMethod.DELETE, entity,
                String.class);
        String message = response.getBody();
        if (message != null) {
            Log.show(message);
        }
    } catch (Throwable t) {
        showErrorMsg(t);
    }
}

From source file:org.springframework.data.keyvalue.riak.client.RiakRestClient.java

@Override
public void deleteKey(String bucket, String key, RiakDeleteParameter... params) throws RiakException {
    executeRiak(HttpMethod.DELETE, null, params, byte[].class, bucket, key);
}

From source file:org.springframework.social.box.api.impl.FileTemplate.java

@Override
public void deleteFile(String fileId) {
    boxOperation(HttpMethod.DELETE, FILE_OPERATION + fileId);
}

From source file:org.springframework.social.box.api.impl.FolderTemplate.java

@Override
public void deleteFolder(String folderId, Boolean recursive) {
    if (recursive == null) {
        recursive = false;//www. j  a v a 2 s . c om
    }
    boxOperation(HttpMethod.DELETE, FOLDER_OPERATION + folderId + "?recursive=" + recursive.toString());
}

From source file:org.springframework.web.client.RestTemplate.java

public void delete(String url, Object... urlVariables) throws RestClientException {
    execute(url, HttpMethod.DELETE, null, null, urlVariables);
}

From source file:org.springframework.web.client.RestTemplate.java

public void delete(String url, Map<String, ?> urlVariables) throws RestClientException {
    execute(url, HttpMethod.DELETE, null, null, urlVariables);
}

From source file:org.springframework.web.client.RestTemplate.java

public void delete(URI url) throws RestClientException {
    execute(url, HttpMethod.DELETE, null, null);
}

From source file:org.springframework.web.reactive.function.server.RequestPredicates.java

/**
 * Return a {@code RequestPredicate} that matches if request's HTTP method is {@code DELETE}
 * and the given {@code pattern} matches against the request path.
 * @param pattern the path pattern to match against
 * @return a predicate that matches if the request method is DELETE and if the given pattern
 * matches against the request path/*w w w . jav a 2  s . co  m*/
 */
public static RequestPredicate DELETE(String pattern) {
    return method(HttpMethod.DELETE).and(path(pattern));
}

From source file:org.tinygroup.springmvc.coc.impl.RestfulConventionHandlerMethodResolver.java

private String[] doResolveInner(String uri, Method method) {
    String hmn = method.getName();
    String[] urls = null;/*w w  w . j  av  a  2 s.  c om*/
    if ("doIndex".equals(hmn)) {
        return this.registerUrls(HttpMethod.GET, method, uri);
    }
    if ("doNew".equals(hmn)) {
        String url = new StringBuilder(uri).append("/new").toString();
        return this.registerUrls(HttpMethod.GET, method, url);

    }
    if ("doCreate".equals(hmn)) {
        return this.registerUrls(HttpMethod.POST, method, uri);
    }
    if ("doShow".equals(hmn)) {
        String url = new StringBuilder(uri).append("/{id}").toString();
        return this.registerUrls(HttpMethod.GET, method, url);
    }
    if ("doEdit".equals(hmn)) {
        String url = new StringBuilder(uri).append("/{id}/edit").toString();
        return this.registerUrls(HttpMethod.GET, method, url);
    }
    if ("doUpdate".equals(hmn)) {
        String url = new StringBuilder(uri).append("/{id}").toString();
        return this.registerUrls(HttpMethod.PUT, method, url);
    }
    if ("doDestroy".equals(hmn)) {
        String url = new StringBuilder(uri).append("/{id}").toString();
        return this.registerUrls(HttpMethod.DELETE, method, url);
    }
    return urls;
}