001/* 002 * Copyright 2002-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.web.client; 018 019import java.net.URI; 020import java.util.Map; 021import java.util.Set; 022 023import org.springframework.core.ParameterizedTypeReference; 024import org.springframework.http.HttpEntity; 025import org.springframework.http.HttpHeaders; 026import org.springframework.http.HttpMethod; 027import org.springframework.http.RequestEntity; 028import org.springframework.http.ResponseEntity; 029 030/** 031 * Interface specifying a basic set of RESTful operations. 032 * Implemented by {@link RestTemplate}. Not often used directly, but a useful 033 * option to enhance testability, as it can easily be mocked or stubbed. 034 * 035 * @author Arjen Poutsma 036 * @author Juergen Hoeller 037 * @since 3.0 038 * @see RestTemplate 039 * @see AsyncRestOperations 040 */ 041public interface RestOperations { 042 043 // GET 044 045 /** 046 * Retrieve a representation by doing a GET on the specified URL. 047 * The response (if any) is converted and returned. 048 * <p>URI Template variables are expanded using the given URI variables, if any. 049 * @param url the URL 050 * @param responseType the type of the return value 051 * @param uriVariables the variables to expand the template 052 * @return the converted object 053 */ 054 <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException; 055 056 /** 057 * Retrieve a representation by doing a GET on the URI template. 058 * The response (if any) is converted and returned. 059 * <p>URI Template variables are expanded using the given map. 060 * @param url the URL 061 * @param responseType the type of the return value 062 * @param uriVariables the map containing variables for the URI template 063 * @return the converted object 064 */ 065 <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException; 066 067 /** 068 * Retrieve a representation by doing a GET on the URL . 069 * The response (if any) is converted and returned. 070 * @param url the URL 071 * @param responseType the type of the return value 072 * @return the converted object 073 */ 074 <T> T getForObject(URI url, Class<T> responseType) throws RestClientException; 075 076 /** 077 * Retrieve an entity by doing a GET on the specified URL. 078 * The response is converted and stored in an {@link ResponseEntity}. 079 * <p>URI Template variables are expanded using the given URI variables, if any. 080 * @param url the URL 081 * @param responseType the type of the return value 082 * @param uriVariables the variables to expand the template 083 * @return the entity 084 * @since 3.0.2 085 */ 086 <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... uriVariables) throws RestClientException; 087 088 /** 089 * Retrieve a representation by doing a GET on the URI template. 090 * The response is converted and stored in an {@link ResponseEntity}. 091 * <p>URI Template variables are expanded using the given map. 092 * @param url the URL 093 * @param responseType the type of the return value 094 * @param uriVariables the map containing variables for the URI template 095 * @return the converted object 096 * @since 3.0.2 097 */ 098 <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException; 099 100 /** 101 * Retrieve a representation by doing a GET on the URL . 102 * The response is converted and stored in an {@link ResponseEntity}. 103 * @param url the URL 104 * @param responseType the type of the return value 105 * @return the converted object 106 * @since 3.0.2 107 */ 108 <T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType) throws RestClientException; 109 110 111 // HEAD 112 113 /** 114 * Retrieve all headers of the resource specified by the URI template. 115 * <p>URI Template variables are expanded using the given URI variables, if any. 116 * @param url the URL 117 * @param uriVariables the variables to expand the template 118 * @return all HTTP headers of that resource 119 */ 120 HttpHeaders headForHeaders(String url, Object... uriVariables) throws RestClientException; 121 122 /** 123 * Retrieve all headers of the resource specified by the URI template. 124 * <p>URI Template variables are expanded using the given map. 125 * @param url the URL 126 * @param uriVariables the map containing variables for the URI template 127 * @return all HTTP headers of that resource 128 */ 129 HttpHeaders headForHeaders(String url, Map<String, ?> uriVariables) throws RestClientException; 130 131 /** 132 * Retrieve all headers of the resource specified by the URL. 133 * @param url the URL 134 * @return all HTTP headers of that resource 135 */ 136 HttpHeaders headForHeaders(URI url) throws RestClientException; 137 138 139 // POST 140 141 /** 142 * Create a new resource by POSTing the given object to the URI template, and returns the value of 143 * the {@code Location} header. This header typically indicates where the new resource is stored. 144 * <p>URI Template variables are expanded using the given URI variables, if any. 145 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 146 * add additional HTTP headers to the request. 147 * @param url the URL 148 * @param request the Object to be POSTed (may be {@code null}) 149 * @param uriVariables the variables to expand the template 150 * @return the value for the {@code Location} header 151 * @see HttpEntity 152 */ 153 URI postForLocation(String url, Object request, Object... uriVariables) throws RestClientException; 154 155 /** 156 * Create a new resource by POSTing the given object to the URI template, and returns the value of 157 * the {@code Location} header. This header typically indicates where the new resource is stored. 158 * <p>URI Template variables are expanded using the given map. 159 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 160 * add additional HTTP headers to the request. 161 * @param url the URL 162 * @param request the Object to be POSTed (may be {@code null}) 163 * @param uriVariables the variables to expand the template 164 * @return the value for the {@code Location} header 165 * @see HttpEntity 166 */ 167 URI postForLocation(String url, Object request, Map<String, ?> uriVariables) throws RestClientException; 168 169 /** 170 * Create a new resource by POSTing the given object to the URL, and returns the value of the 171 * {@code Location} header. This header typically indicates where the new resource is stored. 172 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 173 * add additional HTTP headers to the request. 174 * @param url the URL 175 * @param request the Object to be POSTed (may be {@code null}) 176 * @return the value for the {@code Location} header 177 * @see HttpEntity 178 */ 179 URI postForLocation(URI url, Object request) throws RestClientException; 180 181 /** 182 * Create a new resource by POSTing the given object to the URI template, 183 * and returns the representation found in the response. 184 * <p>URI Template variables are expanded using the given URI variables, if any. 185 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 186 * add additional HTTP headers to the request. 187 * @param url the URL 188 * @param request the Object to be POSTed (may be {@code null}) 189 * @param responseType the type of the return value 190 * @param uriVariables the variables to expand the template 191 * @return the converted object 192 * @see HttpEntity 193 */ 194 <T> T postForObject(String url, Object request, Class<T> responseType, Object... uriVariables) 195 throws RestClientException; 196 197 /** 198 * Create a new resource by POSTing the given object to the URI template, 199 * and returns the representation found in the response. 200 * <p>URI Template variables are expanded using the given map. 201 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 202 * add additional HTTP headers to the request. 203 * @param url the URL 204 * @param request the Object to be POSTed (may be {@code null}) 205 * @param responseType the type of the return value 206 * @param uriVariables the variables to expand the template 207 * @return the converted object 208 * @see HttpEntity 209 */ 210 <T> T postForObject(String url, Object request, Class<T> responseType, Map<String, ?> uriVariables) 211 throws RestClientException; 212 213 /** 214 * Create a new resource by POSTing the given object to the URL, 215 * and returns the representation found in the response. 216 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 217 * add additional HTTP headers to the request. 218 * @param url the URL 219 * @param request the Object to be POSTed (may be {@code null}) 220 * @param responseType the type of the return value 221 * @return the converted object 222 * @see HttpEntity 223 */ 224 <T> T postForObject(URI url, Object request, Class<T> responseType) throws RestClientException; 225 226 /** 227 * Create a new resource by POSTing the given object to the URI template, 228 * and returns the response as {@link ResponseEntity}. 229 * <p>URI Template variables are expanded using the given URI variables, if any. 230 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 231 * add additional HTTP headers to the request. 232 * @param url the URL 233 * @param request the Object to be POSTed (may be {@code null}) 234 * @param uriVariables the variables to expand the template 235 * @return the converted object 236 * @since 3.0.2 237 * @see HttpEntity 238 */ 239 <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> responseType, Object... uriVariables) 240 throws RestClientException; 241 242 /** 243 * Create a new resource by POSTing the given object to the URI template, 244 * and returns the response as {@link HttpEntity}. 245 * <p>URI Template variables are expanded using the given map. 246 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 247 * add additional HTTP headers to the request. 248 * @param url the URL 249 * @param request the Object to be POSTed (may be {@code null}) 250 * @param uriVariables the variables to expand the template 251 * @return the converted object 252 * @since 3.0.2 253 * @see HttpEntity 254 */ 255 <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> responseType, Map<String, ?> uriVariables) 256 throws RestClientException; 257 258 /** 259 * Create a new resource by POSTing the given object to the URL, 260 * and returns the response as {@link ResponseEntity}. 261 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 262 * add additional HTTP headers to the request. 263 * @param url the URL 264 * @param request the Object to be POSTed (may be {@code null}) 265 * @return the converted object 266 * @since 3.0.2 267 * @see HttpEntity 268 */ 269 <T> ResponseEntity<T> postForEntity(URI url, Object request, Class<T> responseType) throws RestClientException; 270 271 272 // PUT 273 274 /** 275 * Create or update a resource by PUTting the given object to the URI. 276 * <p>URI Template variables are expanded using the given URI variables, if any. 277 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 278 * add additional HTTP headers to the request. 279 * @param url the URL 280 * @param request the Object to be PUT (may be {@code null}) 281 * @param uriVariables the variables to expand the template 282 * @see HttpEntity 283 */ 284 void put(String url, Object request, Object... uriVariables) throws RestClientException; 285 286 /** 287 * Creates a new resource by PUTting the given object to URI template. 288 * <p>URI Template variables are expanded using the given map. 289 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 290 * add additional HTTP headers to the request. 291 * @param url the URL 292 * @param request the Object to be PUT (may be {@code null}) 293 * @param uriVariables the variables to expand the template 294 * @see HttpEntity 295 */ 296 void put(String url, Object request, Map<String, ?> uriVariables) throws RestClientException; 297 298 /** 299 * Creates a new resource by PUTting the given object to URL. 300 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 301 * add additional HTTP headers to the request. 302 * @param url the URL 303 * @param request the Object to be PUT (may be {@code null}) 304 * @see HttpEntity 305 */ 306 void put(URI url, Object request) throws RestClientException; 307 308 309 // PATCH 310 311 /** 312 * Update a resource by PATCHing the given object to the URI template, 313 * and return the representation found in the response. 314 * <p>URI Template variables are expanded using the given URI variables, if any. 315 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 316 * add additional HTTP headers to the request. 317 * <p><b>NOTE: The standard JDK HTTP library does not support HTTP PATCH. 318 * You need to use the Apache HttpComponents or OkHttp request factory.</b> 319 * @param url the URL 320 * @param request the object to be PATCHed (may be {@code null}) 321 * @param responseType the type of the return value 322 * @param uriVariables the variables to expand the template 323 * @return the converted object 324 * @since 4.3.5 325 * @see HttpEntity 326 * @see RestTemplate#setRequestFactory 327 * @see org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory 328 * @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory 329 */ 330 <T> T patchForObject(String url, Object request, Class<T> responseType, Object... uriVariables) 331 throws RestClientException; 332 333 /** 334 * Update a resource by PATCHing the given object to the URI template, 335 * and return the representation found in the response. 336 * <p>URI Template variables are expanded using the given map. 337 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 338 * add additional HTTP headers to the request. 339 * <p><b>NOTE: The standard JDK HTTP library does not support HTTP PATCH. 340 * You need to use the Apache HttpComponents or OkHttp request factory.</b> 341 * @param url the URL 342 * @param request the object to be PATCHed (may be {@code null}) 343 * @param responseType the type of the return value 344 * @param uriVariables the variables to expand the template 345 * @return the converted object 346 * @since 4.3.5 347 * @see HttpEntity 348 * @see RestTemplate#setRequestFactory 349 * @see org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory 350 * @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory 351 */ 352 <T> T patchForObject(String url, Object request, Class<T> responseType, Map<String, ?> uriVariables) 353 throws RestClientException; 354 355 /** 356 * Update a resource by PATCHing the given object to the URL, 357 * and return the representation found in the response. 358 * <p>The {@code request} parameter can be a {@link HttpEntity} in order to 359 * add additional HTTP headers to the request. 360 * <p><b>NOTE: The standard JDK HTTP library does not support HTTP PATCH. 361 * You need to use the Apache HttpComponents or OkHttp request factory.</b> 362 * @param url the URL 363 * @param request the object to be PATCHed (may be {@code null}) 364 * @param responseType the type of the return value 365 * @return the converted object 366 * @since 4.3.5 367 * @see HttpEntity 368 * @see RestTemplate#setRequestFactory 369 * @see org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory 370 * @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory 371 */ 372 <T> T patchForObject(URI url, Object request, Class<T> responseType) throws RestClientException; 373 374 375 376 // DELETE 377 378 /** 379 * Delete the resources at the specified URI. 380 * <p>URI Template variables are expanded using the given URI variables, if any. 381 * @param url the URL 382 * @param uriVariables the variables to expand in the template 383 */ 384 void delete(String url, Object... uriVariables) throws RestClientException; 385 386 /** 387 * Delete the resources at the specified URI. 388 * <p>URI Template variables are expanded using the given map. 389 * 390 * @param url the URL 391 * @param uriVariables the variables to expand the template 392 */ 393 void delete(String url, Map<String, ?> uriVariables) throws RestClientException; 394 395 /** 396 * Delete the resources at the specified URL. 397 * @param url the URL 398 */ 399 void delete(URI url) throws RestClientException; 400 401 402 // OPTIONS 403 404 /** 405 * Return the value of the Allow header for the given URI. 406 * <p>URI Template variables are expanded using the given URI variables, if any. 407 * @param url the URL 408 * @param uriVariables the variables to expand in the template 409 * @return the value of the allow header 410 */ 411 Set<HttpMethod> optionsForAllow(String url, Object... uriVariables) throws RestClientException; 412 413 /** 414 * Return the value of the Allow header for the given URI. 415 * <p>URI Template variables are expanded using the given map. 416 * @param url the URL 417 * @param uriVariables the variables to expand in the template 418 * @return the value of the allow header 419 */ 420 Set<HttpMethod> optionsForAllow(String url, Map<String, ?> uriVariables) throws RestClientException; 421 422 /** 423 * Return the value of the Allow header for the given URL. 424 * @param url the URL 425 * @return the value of the allow header 426 */ 427 Set<HttpMethod> optionsForAllow(URI url) throws RestClientException; 428 429 430 // exchange 431 432 /** 433 * Execute the HTTP method to the given URI template, writing the given request entity to the request, and 434 * returns the response as {@link ResponseEntity}. 435 * <p>URI Template variables are expanded using the given URI variables, if any. 436 * @param url the URL 437 * @param method the HTTP method (GET, POST, etc) 438 * @param requestEntity the entity (headers and/or body) to write to the request 439 * may be {@code null}) 440 * @param responseType the type of the return value 441 * @param uriVariables the variables to expand in the template 442 * @return the response as entity 443 * @since 3.0.2 444 */ 445 <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, 446 Class<T> responseType, Object... uriVariables) throws RestClientException; 447 448 /** 449 * Execute the HTTP method to the given URI template, writing the given request entity to the request, and 450 * returns the response as {@link ResponseEntity}. 451 * <p>URI Template variables are expanded using the given URI variables, if any. 452 * @param url the URL 453 * @param method the HTTP method (GET, POST, etc) 454 * @param requestEntity the entity (headers and/or body) to write to the request 455 * (may be {@code null}) 456 * @param responseType the type of the return value 457 * @param uriVariables the variables to expand in the template 458 * @return the response as entity 459 * @since 3.0.2 460 */ 461 <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, 462 Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException; 463 464 /** 465 * Execute the HTTP method to the given URI template, writing the given request entity to the request, and 466 * returns the response as {@link ResponseEntity}. 467 * @param url the URL 468 * @param method the HTTP method (GET, POST, etc) 469 * @param requestEntity the entity (headers and/or body) to write to the request 470 * (may be {@code null}) 471 * @param responseType the type of the return value 472 * @return the response as entity 473 * @since 3.0.2 474 */ 475 <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity, 476 Class<T> responseType) throws RestClientException; 477 478 /** 479 * Execute the HTTP method to the given URI template, writing the given 480 * request entity to the request, and returns the response as {@link ResponseEntity}. 481 * The given {@link ParameterizedTypeReference} is used to pass generic type information: 482 * <pre class="code"> 483 * ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {}; 484 * ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean); 485 * </pre> 486 * @param url the URL 487 * @param method the HTTP method (GET, POST, etc) 488 * @param requestEntity the entity (headers and/or body) to write to the 489 * request (may be {@code null}) 490 * @param responseType the type of the return value 491 * @param uriVariables the variables to expand in the template 492 * @return the response as entity 493 * @since 3.2 494 */ 495 <T> ResponseEntity<T> exchange(String url,HttpMethod method, HttpEntity<?> requestEntity, 496 ParameterizedTypeReference<T> responseType, Object... uriVariables) throws RestClientException; 497 498 /** 499 * Execute the HTTP method to the given URI template, writing the given 500 * request entity to the request, and returns the response as {@link ResponseEntity}. 501 * The given {@link ParameterizedTypeReference} is used to pass generic type information: 502 * <pre class="code"> 503 * ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {}; 504 * ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean); 505 * </pre> 506 * @param url the URL 507 * @param method the HTTP method (GET, POST, etc) 508 * @param requestEntity the entity (headers and/or body) to write to the request 509 * (may be {@code null}) 510 * @param responseType the type of the return value 511 * @param uriVariables the variables to expand in the template 512 * @return the response as entity 513 * @since 3.2 514 */ 515 <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity, 516 ParameterizedTypeReference<T> responseType, Map<String, ?> uriVariables) throws RestClientException; 517 518 /** 519 * Execute the HTTP method to the given URI template, writing the given 520 * request entity to the request, and returns the response as {@link ResponseEntity}. 521 * The given {@link ParameterizedTypeReference} is used to pass generic type information: 522 * <pre class="code"> 523 * ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {}; 524 * ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean); 525 * </pre> 526 * @param url the URL 527 * @param method the HTTP method (GET, POST, etc) 528 * @param requestEntity the entity (headers and/or body) to write to the request 529 * (may be {@code null}) 530 * @param responseType the type of the return value 531 * @return the response as entity 532 * @since 3.2 533 */ 534 <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity, 535 ParameterizedTypeReference<T> responseType) throws RestClientException; 536 537 /** 538 * Execute the request specified in the given {@link RequestEntity} and return 539 * the response as {@link ResponseEntity}. Typically used in combination 540 * with the static builder methods on {@code RequestEntity}, for instance: 541 * <pre class="code"> 542 * MyRequest body = ... 543 * RequestEntity request = RequestEntity.post(new URI("https://example.com/foo")).accept(MediaType.APPLICATION_JSON).body(body); 544 * ResponseEntity<MyResponse> response = template.exchange(request, MyResponse.class); 545 * </pre> 546 * @param requestEntity the entity to write to the request 547 * @param responseType the type of the return value 548 * @return the response as entity 549 * @since 4.1 550 */ 551 <T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, Class<T> responseType) throws RestClientException; 552 553 /** 554 * Execute the request specified in the given {@link RequestEntity} and return 555 * the response as {@link ResponseEntity}. The given 556 * {@link ParameterizedTypeReference} is used to pass generic type information: 557 * <pre class="code"> 558 * MyRequest body = ... 559 * RequestEntity request = RequestEntity.post(new URI("https://example.com/foo")).accept(MediaType.APPLICATION_JSON).body(body); 560 * ParameterizedTypeReference<List<MyResponse>> myBean = new ParameterizedTypeReference<List<MyResponse>>() {}; 561 * ResponseEntity<List<MyResponse>> response = template.exchange(request, myBean); 562 * </pre> 563 * @param requestEntity the entity to write to the request 564 * @param responseType the type of the return value 565 * @return the response as entity 566 * @since 4.1 567 */ 568 <T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) 569 throws RestClientException; 570 571 572 // general execution 573 574 /** 575 * Execute the HTTP method to the given URI template, preparing the request with the 576 * {@link RequestCallback}, and reading the response with a {@link ResponseExtractor}. 577 * <p>URI Template variables are expanded using the given URI variables, if any. 578 * @param url the URL 579 * @param method the HTTP method (GET, POST, etc) 580 * @param requestCallback object that prepares the request 581 * @param responseExtractor object that extracts the return value from the response 582 * @param uriVariables the variables to expand in the template 583 * @return an arbitrary object, as returned by the {@link ResponseExtractor} 584 */ 585 <T> T execute(String url, HttpMethod method, RequestCallback requestCallback, 586 ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException; 587 588 /** 589 * Execute the HTTP method to the given URI template, preparing the request with the 590 * {@link RequestCallback}, and reading the response with a {@link ResponseExtractor}. 591 * <p>URI Template variables are expanded using the given URI variables map. 592 * @param url the URL 593 * @param method the HTTP method (GET, POST, etc) 594 * @param requestCallback object that prepares the request 595 * @param responseExtractor object that extracts the return value from the response 596 * @param uriVariables the variables to expand in the template 597 * @return an arbitrary object, as returned by the {@link ResponseExtractor} 598 */ 599 <T> T execute(String url, HttpMethod method, RequestCallback requestCallback, 600 ResponseExtractor<T> responseExtractor, Map<String, ?> uriVariables) throws RestClientException; 601 602 /** 603 * Execute the HTTP method to the given URL, preparing the request with the 604 * {@link RequestCallback}, and reading the response with a {@link ResponseExtractor}. 605 * @param url the URL 606 * @param method the HTTP method (GET, POST, etc) 607 * @param requestCallback object that prepares the request 608 * @param responseExtractor object that extracts the return value from the response 609 * @return an arbitrary object, as returned by the {@link ResponseExtractor} 610 */ 611 <T> T execute(URI url, HttpMethod method, RequestCallback requestCallback, 612 ResponseExtractor<T> responseExtractor) throws RestClientException; 613 614}