diff --git a/spring-web/src/main/java/org/springframework/web/client/AsyncRestOperations.java b/spring-web/src/main/java/org/springframework/web/client/AsyncRestOperations.java index 9abd6ea87b0..8c8af1125cc 100644 --- a/spring-web/src/main/java/org/springframework/web/client/AsyncRestOperations.java +++ b/spring-web/src/main/java/org/springframework/web/client/AsyncRestOperations.java @@ -192,57 +192,63 @@ public interface AsyncRestOperations { /** * Create or update a resource by PUTting the given object to the URI. *

URI Template variables are expanded using the given URI variables, if any. + *

The Future will return a {@code null} result upon completion. * @param url the URL * @param request the Object to be PUT, may be {@code null} * @param uriVariables the variables to expand the template * @see HttpEntity */ - Future put(String url, HttpEntity request, Object... uriVariables) + Future put(String url, HttpEntity request, Object... uriVariables) throws RestClientException; /** * Creates a new resource by PUTting the given object to URI template. *

URI Template variables are expanded using the given map. + *

The Future will return a {@code null} result upon completion. * @param url the URL * @param request the Object to be PUT, may be {@code null} * @param uriVariables the variables to expand the template * @see HttpEntity */ - Future put(String url, HttpEntity request, Map uriVariables) + Future put(String url, HttpEntity request, Map uriVariables) throws RestClientException; /** * Creates a new resource by PUTting the given object to URL. + *

The Future will return a {@code null} result upon completion. * @param url the URL * @param request the Object to be PUT, may be {@code null} * @see HttpEntity */ - Future put(URI url, HttpEntity request) throws RestClientException; + Future put(URI url, HttpEntity request) throws RestClientException; // DELETE /** * Asynchronously delete the resources at the specified URI. *

URI Template variables are expanded using the given URI variables, if any. + *

The Future will return a {@code null} result upon completion. * @param url the URL * @param uriVariables the variables to expand in the template */ - Future delete(String url, Object... uriVariables) throws RestClientException; + Future delete(String url, Object... uriVariables) throws RestClientException; /** * Asynchronously delete the resources at the specified URI. *

URI Template variables are expanded using the given URI variables, if any. + *

The Future will return a {@code null} result upon completion. * @param url the URL * @param uriVariables the variables to expand in the template */ - Future delete(String url, Map uriVariables) throws RestClientException; + Future delete(String url, Map uriVariables) throws RestClientException; /** * Asynchronously delete the resources at the specified URI. *

URI Template variables are expanded using the given URI variables, if any. + *

The Future will return a {@code null} result upon completion. * @param url the URL */ - Future delete(URI url) throws RestClientException; + Future delete(URI url) throws RestClientException; // OPTIONS diff --git a/spring-web/src/main/java/org/springframework/web/client/AsyncRestTemplate.java b/spring-web/src/main/java/org/springframework/web/client/AsyncRestTemplate.java index 731db4c0886..3e8092ef8f7 100644 --- a/spring-web/src/main/java/org/springframework/web/client/AsyncRestTemplate.java +++ b/spring-web/src/main/java/org/springframework/web/client/AsyncRestTemplate.java @@ -304,21 +304,21 @@ public class AsyncRestTemplate extends AsyncHttpAccessor implements AsyncRestOpe // PUT @Override - public Future put(String url, HttpEntity request, Object... uriVariables) + public Future put(String url, HttpEntity request, Object... uriVariables) throws RestClientException { AsyncRequestCallback requestCallback = httpEntityCallback(request); return execute(url, HttpMethod.PUT, requestCallback, null, uriVariables); } @Override - public Future put(String url, HttpEntity request, + public Future put(String url, HttpEntity request, Map uriVariables) throws RestClientException { AsyncRequestCallback requestCallback = httpEntityCallback(request); return execute(url, HttpMethod.PUT, requestCallback, null, uriVariables); } @Override - public Future put(URI url, HttpEntity request) throws RestClientException { + public Future put(URI url, HttpEntity request) throws RestClientException { AsyncRequestCallback requestCallback = httpEntityCallback(request); return execute(url, HttpMethod.PUT, requestCallback, null); } @@ -326,19 +326,19 @@ public class AsyncRestTemplate extends AsyncHttpAccessor implements AsyncRestOpe // DELETE @Override - public Future delete(String url, Object... urlVariables) + public Future delete(String url, Object... urlVariables) throws RestClientException { return execute(url, HttpMethod.DELETE, null, null, urlVariables); } @Override - public Future delete(String url, Map urlVariables) + public Future delete(String url, Map urlVariables) throws RestClientException { return execute(url, HttpMethod.DELETE, null, null, urlVariables); } @Override - public Future delete(URI url) throws RestClientException { + public Future delete(URI url) throws RestClientException { return execute(url, HttpMethod.DELETE, null, null); } diff --git a/spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java b/spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java index 87657398640..33ab3c25ac0 100644 --- a/spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java @@ -149,7 +149,7 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa public void put() throws URISyntaxException, ExecutionException, InterruptedException { HttpEntity requestEntity = new HttpEntity<>(helloWorld); - Future + Future responseEntityFuture = template.put(baseUrl + "/{method}", requestEntity, "put"); responseEntityFuture.get(); @@ -158,7 +158,7 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa @Test public void delete() throws URISyntaxException, ExecutionException, InterruptedException { - Future deletedFuture = template.delete(new URI(baseUrl + "/delete")); + Future deletedFuture = template.delete(new URI(baseUrl + "/delete")); deletedFuture.get(); }