Consistent use of "URI variables" terminology
Issue: SPR-14969
This commit is contained in:
@@ -126,7 +126,7 @@ public class MockHttpServletRequestBuilder
|
|||||||
* {@link #with(RequestPostProcessor)}.
|
* {@link #with(RequestPostProcessor)}.
|
||||||
* @param httpMethod the HTTP method (GET, POST, etc)
|
* @param httpMethod the HTTP method (GET, POST, etc)
|
||||||
* @param url a URL template; the resulting URL will be encoded
|
* @param url a URL template; the resulting URL will be encoded
|
||||||
* @param vars zero or more URL variables
|
* @param vars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
MockHttpServletRequestBuilder(HttpMethod httpMethod, String url, Object... vars) {
|
MockHttpServletRequestBuilder(HttpMethod httpMethod, String url, Object... vars) {
|
||||||
this(httpMethod.name(), UriComponentsBuilder.fromUriString(url).buildAndExpand(vars).encode().toUri());
|
this(httpMethod.name(), UriComponentsBuilder.fromUriString(url).buildAndExpand(vars).encode().toUri());
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ public class MockMultipartHttpServletRequestBuilder extends MockHttpServletReque
|
|||||||
* see {@link #with(RequestPostProcessor)} and the
|
* see {@link #with(RequestPostProcessor)} and the
|
||||||
* {@link RequestPostProcessor} extension point.
|
* {@link RequestPostProcessor} extension point.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVariables zero or more URL variables
|
* @param uriVariables zero or more URI variables
|
||||||
*/
|
*/
|
||||||
MockMultipartHttpServletRequestBuilder(String urlTemplate, Object... urlVariables) {
|
MockMultipartHttpServletRequestBuilder(String urlTemplate, Object... uriVariables) {
|
||||||
super(HttpMethod.POST, urlTemplate, urlVariables);
|
super(HttpMethod.POST, urlTemplate, uriVariables);
|
||||||
super.contentType(MediaType.MULTIPART_FORM_DATA);
|
super.contentType(MediaType.MULTIPART_FORM_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
/**
|
/**
|
||||||
* Create a {@link MockHttpServletRequestBuilder} for a GET request.
|
* Create a {@link MockHttpServletRequestBuilder} for a GET request.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
public static MockHttpServletRequestBuilder get(String urlTemplate, Object... urlVars) {
|
public static MockHttpServletRequestBuilder get(String urlTemplate, Object... uriVars) {
|
||||||
return new MockHttpServletRequestBuilder(HttpMethod.GET, urlTemplate, urlVars);
|
return new MockHttpServletRequestBuilder(HttpMethod.GET, urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,10 +68,10 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
/**
|
/**
|
||||||
* Create a {@link MockHttpServletRequestBuilder} for a POST request.
|
* Create a {@link MockHttpServletRequestBuilder} for a POST request.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
public static MockHttpServletRequestBuilder post(String urlTemplate, Object... urlVars) {
|
public static MockHttpServletRequestBuilder post(String urlTemplate, Object... uriVars) {
|
||||||
return new MockHttpServletRequestBuilder(HttpMethod.POST, urlTemplate, urlVars);
|
return new MockHttpServletRequestBuilder(HttpMethod.POST, urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,10 +86,10 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
/**
|
/**
|
||||||
* Create a {@link MockHttpServletRequestBuilder} for a PUT request.
|
* Create a {@link MockHttpServletRequestBuilder} for a PUT request.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
public static MockHttpServletRequestBuilder put(String urlTemplate, Object... urlVars) {
|
public static MockHttpServletRequestBuilder put(String urlTemplate, Object... uriVars) {
|
||||||
return new MockHttpServletRequestBuilder(HttpMethod.PUT, urlTemplate, urlVars);
|
return new MockHttpServletRequestBuilder(HttpMethod.PUT, urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,10 +104,10 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
/**
|
/**
|
||||||
* Create a {@link MockHttpServletRequestBuilder} for a PATCH request.
|
* Create a {@link MockHttpServletRequestBuilder} for a PATCH request.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
public static MockHttpServletRequestBuilder patch(String urlTemplate, Object... urlVars) {
|
public static MockHttpServletRequestBuilder patch(String urlTemplate, Object... uriVars) {
|
||||||
return new MockHttpServletRequestBuilder(HttpMethod.PATCH, urlTemplate, urlVars);
|
return new MockHttpServletRequestBuilder(HttpMethod.PATCH, urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,10 +122,10 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
/**
|
/**
|
||||||
* Create a {@link MockHttpServletRequestBuilder} for a DELETE request.
|
* Create a {@link MockHttpServletRequestBuilder} for a DELETE request.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
public static MockHttpServletRequestBuilder delete(String urlTemplate, Object... urlVars) {
|
public static MockHttpServletRequestBuilder delete(String urlTemplate, Object... uriVars) {
|
||||||
return new MockHttpServletRequestBuilder(HttpMethod.DELETE, urlTemplate, urlVars);
|
return new MockHttpServletRequestBuilder(HttpMethod.DELETE, urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,10 +140,10 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
/**
|
/**
|
||||||
* Create a {@link MockHttpServletRequestBuilder} for an OPTIONS request.
|
* Create a {@link MockHttpServletRequestBuilder} for an OPTIONS request.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
public static MockHttpServletRequestBuilder options(String urlTemplate, Object... urlVars) {
|
public static MockHttpServletRequestBuilder options(String urlTemplate, Object... uriVars) {
|
||||||
return new MockHttpServletRequestBuilder(HttpMethod.OPTIONS, urlTemplate, urlVars);
|
return new MockHttpServletRequestBuilder(HttpMethod.OPTIONS, urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,11 +158,11 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
/**
|
/**
|
||||||
* Create a {@link MockHttpServletRequestBuilder} for a HEAD request.
|
* Create a {@link MockHttpServletRequestBuilder} for a HEAD request.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public static MockHttpServletRequestBuilder head(String urlTemplate, Object... urlVars) {
|
public static MockHttpServletRequestBuilder head(String urlTemplate, Object... uriVars) {
|
||||||
return new MockHttpServletRequestBuilder(HttpMethod.HEAD, urlTemplate, urlVars);
|
return new MockHttpServletRequestBuilder(HttpMethod.HEAD, urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,10 +178,10 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
* Create a {@link MockHttpServletRequestBuilder} for a request with the given HTTP method.
|
* Create a {@link MockHttpServletRequestBuilder} for a request with the given HTTP method.
|
||||||
* @param method the HTTP method (GET, POST, etc)
|
* @param method the HTTP method (GET, POST, etc)
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
public static MockHttpServletRequestBuilder request(HttpMethod method, String urlTemplate, Object... urlVars) {
|
public static MockHttpServletRequestBuilder request(HttpMethod method, String urlTemplate, Object... uriVars) {
|
||||||
return new MockHttpServletRequestBuilder(method, urlTemplate, urlVars);
|
return new MockHttpServletRequestBuilder(method, urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,10 +207,10 @@ public abstract class MockMvcRequestBuilders {
|
|||||||
/**
|
/**
|
||||||
* Create a {@link MockMultipartHttpServletRequestBuilder} for a multipart request.
|
* Create a {@link MockMultipartHttpServletRequestBuilder} for a multipart request.
|
||||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||||
* @param urlVars zero or more URL variables
|
* @param uriVars zero or more URI variables
|
||||||
*/
|
*/
|
||||||
public static MockMultipartHttpServletRequestBuilder fileUpload(String urlTemplate, Object... urlVars) {
|
public static MockMultipartHttpServletRequestBuilder fileUpload(String urlTemplate, Object... uriVars) {
|
||||||
return new MockMultipartHttpServletRequestBuilder(urlTemplate, urlVars);
|
return new MockMultipartHttpServletRequestBuilder(urlTemplate, uriVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -83,11 +83,11 @@ public abstract class MockMvcResultMatchers {
|
|||||||
* Asserts the request was forwarded to the given URL.
|
* Asserts the request was forwarded to the given URL.
|
||||||
* <p>This method accepts exact matches against the expanded URL template.
|
* <p>This method accepts exact matches against the expanded URL template.
|
||||||
* @param urlTemplate a URL template; the expanded URL will be encoded
|
* @param urlTemplate a URL template; the expanded URL will be encoded
|
||||||
* @param urlVars zero or more URL variables to populate the template
|
* @param uriVars zero or more URI variables to populate the template
|
||||||
* @see UriComponentsBuilder#fromUriString(String)
|
* @see UriComponentsBuilder#fromUriString(String)
|
||||||
*/
|
*/
|
||||||
public static ResultMatcher forwardedUrl(String urlTemplate, Object... urlVars) {
|
public static ResultMatcher forwardedUrl(String urlTemplate, Object... uriVars) {
|
||||||
String uri = UriComponentsBuilder.fromUriString(urlTemplate).buildAndExpand(urlVars).encode().toUriString();
|
String uri = UriComponentsBuilder.fromUriString(urlTemplate).buildAndExpand(uriVars).encode().toUriString();
|
||||||
return result -> assertEquals("Forwarded URL", uri, result.getResponse().getForwardedUrl());
|
return result -> assertEquals("Forwarded URL", uri, result.getResponse().getForwardedUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,11 +111,11 @@ public abstract class MockMvcResultMatchers {
|
|||||||
* Asserts the request was redirected to the given URL.
|
* Asserts the request was redirected to the given URL.
|
||||||
* <p>This method accepts exact matches against the expanded URL template.
|
* <p>This method accepts exact matches against the expanded URL template.
|
||||||
* @param urlTemplate a URL template; the expanded URL will be encoded
|
* @param urlTemplate a URL template; the expanded URL will be encoded
|
||||||
* @param urlVars zero or more URL variables to populate the template
|
* @param uriVars zero or more URI variables to populate the template
|
||||||
* @see UriComponentsBuilder#fromUriString(String)
|
* @see UriComponentsBuilder#fromUriString(String)
|
||||||
*/
|
*/
|
||||||
public static ResultMatcher redirectedUrl(String urlTemplate, Object... urlVars) {
|
public static ResultMatcher redirectedUrl(String urlTemplate, Object... uriVars) {
|
||||||
String uri = UriComponentsBuilder.fromUriString(urlTemplate).buildAndExpand(urlVars).encode().toUriString();
|
String uri = UriComponentsBuilder.fromUriString(urlTemplate).buildAndExpand(uriVars).encode().toUriString();
|
||||||
return result -> assertEquals("Redirected URL", uri, result.getResponse().getRedirectedUrl());
|
return result -> assertEquals("Redirected URL", uri, result.getResponse().getRedirectedUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -221,11 +221,11 @@ public class AsyncRestTemplate extends InterceptingAsyncHttpAccessor implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> ListenableFuture<ResponseEntity<T>> getForEntity(String url, Class<T> responseType,
|
public <T> ListenableFuture<ResponseEntity<T>> getForEntity(String url, Class<T> responseType,
|
||||||
Map<String, ?> urlVariables) throws RestClientException {
|
Map<String, ?> uriVariables) throws RestClientException {
|
||||||
|
|
||||||
AsyncRequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
AsyncRequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
||||||
ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
|
ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
|
||||||
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, urlVariables);
|
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -348,13 +348,13 @@ public class AsyncRestTemplate extends InterceptingAsyncHttpAccessor implements
|
|||||||
// DELETE
|
// DELETE
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<?> delete(String url, Object... urlVariables) throws RestClientException {
|
public ListenableFuture<?> delete(String url, Object... uriVariables) throws RestClientException {
|
||||||
return execute(url, HttpMethod.DELETE, null, null, urlVariables);
|
return execute(url, HttpMethod.DELETE, null, null, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<?> delete(String url, Map<String, ?> urlVariables) throws RestClientException {
|
public ListenableFuture<?> delete(String url, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
return execute(url, HttpMethod.DELETE, null, null, urlVariables);
|
return execute(url, HttpMethod.DELETE, null, null, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -459,17 +459,17 @@ public class AsyncRestTemplate extends InterceptingAsyncHttpAccessor implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> ListenableFuture<T> execute(String url, HttpMethod method, AsyncRequestCallback requestCallback,
|
public <T> ListenableFuture<T> execute(String url, HttpMethod method, AsyncRequestCallback requestCallback,
|
||||||
ResponseExtractor<T> responseExtractor, Object... urlVariables) throws RestClientException {
|
ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException {
|
||||||
|
|
||||||
URI expanded = getUriTemplateHandler().expand(url, urlVariables);
|
URI expanded = getUriTemplateHandler().expand(url, uriVariables);
|
||||||
return doExecute(expanded, method, requestCallback, responseExtractor);
|
return doExecute(expanded, method, requestCallback, responseExtractor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> ListenableFuture<T> execute(String url, HttpMethod method, AsyncRequestCallback requestCallback,
|
public <T> ListenableFuture<T> execute(String url, HttpMethod method, AsyncRequestCallback requestCallback,
|
||||||
ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables) throws RestClientException {
|
ResponseExtractor<T> responseExtractor, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
|
|
||||||
URI expanded = getUriTemplateHandler().expand(url, urlVariables);
|
URI expanded = getUriTemplateHandler().expand(url, uriVariables);
|
||||||
return doExecute(expanded, method, requestCallback, responseExtractor);
|
return doExecute(expanded, method, requestCallback, responseExtractor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -294,19 +294,19 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||||||
// GET
|
// GET
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T getForObject(String url, Class<T> responseType, Object... urlVariables) throws RestClientException {
|
public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
|
||||||
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
||||||
HttpMessageConverterExtractor<T> responseExtractor =
|
HttpMessageConverterExtractor<T> responseExtractor =
|
||||||
new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
|
new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
|
||||||
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, urlVariables);
|
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> urlVariables) throws RestClientException {
|
public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
||||||
HttpMessageConverterExtractor<T> responseExtractor =
|
HttpMessageConverterExtractor<T> responseExtractor =
|
||||||
new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
|
new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
|
||||||
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, urlVariables);
|
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -318,21 +318,21 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... urlVariables)
|
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... uriVariables)
|
||||||
throws RestClientException {
|
throws RestClientException {
|
||||||
|
|
||||||
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
||||||
ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
|
ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
|
||||||
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, urlVariables);
|
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ?> urlVariables)
|
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ?> uriVariables)
|
||||||
throws RestClientException {
|
throws RestClientException {
|
||||||
|
|
||||||
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
|
||||||
ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
|
ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
|
||||||
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, urlVariables);
|
return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -346,13 +346,13 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||||||
// HEAD
|
// HEAD
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpHeaders headForHeaders(String url, Object... urlVariables) throws RestClientException {
|
public HttpHeaders headForHeaders(String url, Object... uriVariables) throws RestClientException {
|
||||||
return execute(url, HttpMethod.HEAD, null, headersExtractor(), urlVariables);
|
return execute(url, HttpMethod.HEAD, null, headersExtractor(), uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpHeaders headForHeaders(String url, Map<String, ?> urlVariables) throws RestClientException {
|
public HttpHeaders headForHeaders(String url, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
return execute(url, HttpMethod.HEAD, null, headersExtractor(), urlVariables);
|
return execute(url, HttpMethod.HEAD, null, headersExtractor(), uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -364,16 +364,16 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||||||
// POST
|
// POST
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI postForLocation(String url, Object request, Object... urlVariables) throws RestClientException {
|
public URI postForLocation(String url, Object request, Object... uriVariables) throws RestClientException {
|
||||||
RequestCallback requestCallback = httpEntityCallback(request);
|
RequestCallback requestCallback = httpEntityCallback(request);
|
||||||
HttpHeaders headers = execute(url, HttpMethod.POST, requestCallback, headersExtractor(), urlVariables);
|
HttpHeaders headers = execute(url, HttpMethod.POST, requestCallback, headersExtractor(), uriVariables);
|
||||||
return headers.getLocation();
|
return headers.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI postForLocation(String url, Object request, Map<String, ?> urlVariables) throws RestClientException {
|
public URI postForLocation(String url, Object request, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
RequestCallback requestCallback = httpEntityCallback(request);
|
RequestCallback requestCallback = httpEntityCallback(request);
|
||||||
HttpHeaders headers = execute(url, HttpMethod.POST, requestCallback, headersExtractor(), urlVariables);
|
HttpHeaders headers = execute(url, HttpMethod.POST, requestCallback, headersExtractor(), uriVariables);
|
||||||
return headers.getLocation();
|
return headers.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,15 +441,15 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||||||
// PUT
|
// PUT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void put(String url, Object request, Object... urlVariables) throws RestClientException {
|
public void put(String url, Object request, Object... uriVariables) throws RestClientException {
|
||||||
RequestCallback requestCallback = httpEntityCallback(request);
|
RequestCallback requestCallback = httpEntityCallback(request);
|
||||||
execute(url, HttpMethod.PUT, requestCallback, null, urlVariables);
|
execute(url, HttpMethod.PUT, requestCallback, null, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void put(String url, Object request, Map<String, ?> urlVariables) throws RestClientException {
|
public void put(String url, Object request, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
RequestCallback requestCallback = httpEntityCallback(request);
|
RequestCallback requestCallback = httpEntityCallback(request);
|
||||||
execute(url, HttpMethod.PUT, requestCallback, null, urlVariables);
|
execute(url, HttpMethod.PUT, requestCallback, null, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -493,13 +493,13 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||||||
// DELETE
|
// DELETE
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String url, Object... urlVariables) throws RestClientException {
|
public void delete(String url, Object... uriVariables) throws RestClientException {
|
||||||
execute(url, HttpMethod.DELETE, null, null, urlVariables);
|
execute(url, HttpMethod.DELETE, null, null, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String url, Map<String, ?> urlVariables) throws RestClientException {
|
public void delete(String url, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
execute(url, HttpMethod.DELETE, null, null, urlVariables);
|
execute(url, HttpMethod.DELETE, null, null, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -511,16 +511,16 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||||||
// OPTIONS
|
// OPTIONS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<HttpMethod> optionsForAllow(String url, Object... urlVariables) throws RestClientException {
|
public Set<HttpMethod> optionsForAllow(String url, Object... uriVariables) throws RestClientException {
|
||||||
ResponseExtractor<HttpHeaders> headersExtractor = headersExtractor();
|
ResponseExtractor<HttpHeaders> headersExtractor = headersExtractor();
|
||||||
HttpHeaders headers = execute(url, HttpMethod.OPTIONS, null, headersExtractor, urlVariables);
|
HttpHeaders headers = execute(url, HttpMethod.OPTIONS, null, headersExtractor, uriVariables);
|
||||||
return headers.getAllow();
|
return headers.getAllow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<HttpMethod> optionsForAllow(String url, Map<String, ?> urlVariables) throws RestClientException {
|
public Set<HttpMethod> optionsForAllow(String url, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
ResponseExtractor<HttpHeaders> headersExtractor = headersExtractor();
|
ResponseExtractor<HttpHeaders> headersExtractor = headersExtractor();
|
||||||
HttpHeaders headers = execute(url, HttpMethod.OPTIONS, null, headersExtractor, urlVariables);
|
HttpHeaders headers = execute(url, HttpMethod.OPTIONS, null, headersExtractor, uriVariables);
|
||||||
return headers.getAllow();
|
return headers.getAllow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,17 +619,17 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
|
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
|
||||||
ResponseExtractor<T> responseExtractor, Object... urlVariables) throws RestClientException {
|
ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException {
|
||||||
|
|
||||||
URI expanded = getUriTemplateHandler().expand(url, urlVariables);
|
URI expanded = getUriTemplateHandler().expand(url, uriVariables);
|
||||||
return doExecute(expanded, method, requestCallback, responseExtractor);
|
return doExecute(expanded, method, requestCallback, responseExtractor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
|
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
|
||||||
ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables) throws RestClientException {
|
ResponseExtractor<T> responseExtractor, Map<String, ?> uriVariables) throws RestClientException {
|
||||||
|
|
||||||
URI expanded = getUriTemplateHandler().expand(url, urlVariables);
|
URI expanded = getUriTemplateHandler().expand(url, uriVariables);
|
||||||
return doExecute(expanded, method, requestCallback, responseExtractor);
|
return doExecute(expanded, method, requestCallback, responseExtractor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,83 +115,83 @@ public interface ClientRequest<T> {
|
|||||||
* Create a builder with the given method and url template.
|
* Create a builder with the given method and url template.
|
||||||
* @param method the HTTP method (GET, POST, etc)
|
* @param method the HTTP method (GET, POST, etc)
|
||||||
* @param urlTemplate the URL template
|
* @param urlTemplate the URL template
|
||||||
* @param urlVariables optional variable to expand the template
|
* @param uriVariables optional variables to expand the template
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
*/
|
*/
|
||||||
static BodyBuilder method(HttpMethod method, String urlTemplate, Object... urlVariables) {
|
static BodyBuilder method(HttpMethod method, String urlTemplate, Object... uriVariables) {
|
||||||
UriTemplateHandler templateHandler = new DefaultUriTemplateHandler();
|
UriTemplateHandler templateHandler = new DefaultUriTemplateHandler();
|
||||||
URI url = templateHandler.expand(urlTemplate, urlVariables);
|
URI url = templateHandler.expand(urlTemplate, uriVariables);
|
||||||
return new DefaultClientRequestBuilder(method, url);
|
return new DefaultClientRequestBuilder(method, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an HTTP GET builder with the given url template.
|
* Create an HTTP GET builder with the given url template.
|
||||||
* @param urlTemplate the URL template
|
* @param urlTemplate the URL template
|
||||||
* @param urlVariables optional variable to expand the template
|
* @param uriVariables optional variables to expand the template
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
*/
|
*/
|
||||||
static HeadersBuilder<?> GET(String urlTemplate, Object... urlVariables) {
|
static HeadersBuilder<?> GET(String urlTemplate, Object... uriVariables) {
|
||||||
return method(HttpMethod.GET, urlTemplate, urlVariables);
|
return method(HttpMethod.GET, urlTemplate, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an HTTP HEAD builder with the given url template.
|
* Create an HTTP HEAD builder with the given url template.
|
||||||
* @param urlTemplate the URL template
|
* @param urlTemplate the URL template
|
||||||
* @param urlVariables optional variable to expand the template
|
* @param uriVariables optional variables to expand the template
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
*/
|
*/
|
||||||
static HeadersBuilder<?> HEAD(String urlTemplate, Object... urlVariables) {
|
static HeadersBuilder<?> HEAD(String urlTemplate, Object... uriVariables) {
|
||||||
return method(HttpMethod.HEAD, urlTemplate, urlVariables);
|
return method(HttpMethod.HEAD, urlTemplate, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an HTTP POST builder with the given url template.
|
* Create an HTTP POST builder with the given url template.
|
||||||
* @param urlTemplate the URL template
|
* @param urlTemplate the URL template
|
||||||
* @param urlVariables optional variable to expand the template
|
* @param uriVariables optional variables to expand the template
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
*/
|
*/
|
||||||
static BodyBuilder POST(String urlTemplate, Object... urlVariables) {
|
static BodyBuilder POST(String urlTemplate, Object... uriVariables) {
|
||||||
return method(HttpMethod.POST, urlTemplate, urlVariables);
|
return method(HttpMethod.POST, urlTemplate, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an HTTP PUT builder with the given url template.
|
* Create an HTTP PUT builder with the given url template.
|
||||||
* @param urlTemplate the URL template
|
* @param urlTemplate the URL template
|
||||||
* @param urlVariables optional variable to expand the template
|
* @param uriVariables optional variables to expand the template
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
*/
|
*/
|
||||||
static BodyBuilder PUT(String urlTemplate, Object... urlVariables) {
|
static BodyBuilder PUT(String urlTemplate, Object... uriVariables) {
|
||||||
return method(HttpMethod.PUT, urlTemplate, urlVariables);
|
return method(HttpMethod.PUT, urlTemplate, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an HTTP PATCH builder with the given url template.
|
* Create an HTTP PATCH builder with the given url template.
|
||||||
* @param urlTemplate the URL template
|
* @param urlTemplate the URL template
|
||||||
* @param urlVariables optional variable to expand the template
|
* @param uriVariables optional variables to expand the template
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
*/
|
*/
|
||||||
static BodyBuilder PATCH(String urlTemplate, Object... urlVariables) {
|
static BodyBuilder PATCH(String urlTemplate, Object... uriVariables) {
|
||||||
return method(HttpMethod.PATCH, urlTemplate, urlVariables);
|
return method(HttpMethod.PATCH, urlTemplate, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an HTTP DELETE builder with the given url template.
|
* Create an HTTP DELETE builder with the given url template.
|
||||||
* @param urlTemplate the URL template
|
* @param urlTemplate the URL template
|
||||||
* @param urlVariables optional variable to expand the template
|
* @param uriVariables optional variables to expand the template
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
*/
|
*/
|
||||||
static HeadersBuilder<?> DELETE(String urlTemplate, Object... urlVariables) {
|
static HeadersBuilder<?> DELETE(String urlTemplate, Object... uriVariables) {
|
||||||
return method(HttpMethod.DELETE, urlTemplate, urlVariables);
|
return method(HttpMethod.DELETE, urlTemplate, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an HTTP OPTIONS builder with the given url template.
|
* Creates an HTTP OPTIONS builder with the given url template.
|
||||||
* @param urlTemplate the URL template
|
* @param urlTemplate the URL template
|
||||||
* @param urlVariables optional variable to expand the template
|
* @param uriVariables optional variables to expand the template
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
*/
|
*/
|
||||||
static HeadersBuilder<?> OPTIONS(String urlTemplate, Object... urlVariables) {
|
static HeadersBuilder<?> OPTIONS(String urlTemplate, Object... uriVariables) {
|
||||||
return method(HttpMethod.OPTIONS, urlTemplate, urlVariables);
|
return method(HttpMethod.OPTIONS, urlTemplate, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user