1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
6
6
* You may obtain a copy of the License at
7
7
*
8
- * http://www.apache.org/licenses/LICENSE-2.0
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
9
*
10
10
* Unless required by applicable law or agreed to in writing, software
11
11
* distributed under the License is distributed on an "AS IS" BASIS,
28
28
import org .springframework .http .ResponseEntity ;
29
29
30
30
/**
31
- * Interface specifying a basic set of RESTful operations. Implemented by {@link RestTemplate}.
32
- * Not often used directly, but a useful option to enhance testability, as it can easily
33
- * be mocked or stubbed.
31
+ * Interface specifying a basic set of RESTful operations.
32
+ * Implemented by {@link RestTemplate}. Not often used directly, but a useful
33
+ * option to enhance testability, as it can easily be mocked or stubbed.
34
34
*
35
35
* @author Arjen Poutsma
36
36
* @author Juergen Hoeller
@@ -139,27 +139,27 @@ public interface RestOperations {
139
139
// POST
140
140
141
141
/**
142
- * Create a new resource by POSTing the given object to the URI template, and returns the value of the
143
- * {@code Location} header. This header typically indicates where the new resource is stored.
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
144
* <p>URI Template variables are expanded using the given URI variables, if any.
145
145
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
146
146
* add additional HTTP headers to the request.
147
147
* @param url the URL
148
- * @param request the Object to be POSTed, may be {@code null}
148
+ * @param request the Object to be POSTed ( may be {@code null})
149
149
* @param uriVariables the variables to expand the template
150
150
* @return the value for the {@code Location} header
151
151
* @see HttpEntity
152
152
*/
153
153
URI postForLocation (String url , Object request , Object ... uriVariables ) throws RestClientException ;
154
154
155
155
/**
156
- * Create a new resource by POSTing the given object to the URI template, and returns the value of the
157
- * {@code Location} header. This header typically indicates where the new resource is stored.
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
158
* <p>URI Template variables are expanded using the given map.
159
159
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
160
160
* add additional HTTP headers to the request.
161
161
* @param url the URL
162
- * @param request the Object to be POSTed, may be {@code null}
162
+ * @param request the Object to be POSTed ( may be {@code null})
163
163
* @param uriVariables the variables to expand the template
164
164
* @return the value for the {@code Location} header
165
165
* @see HttpEntity
@@ -172,7 +172,7 @@ public interface RestOperations {
172
172
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
173
173
* add additional HTTP headers to the request.
174
174
* @param url the URL
175
- * @param request the Object to be POSTed, may be {@code null}
175
+ * @param request the Object to be POSTed ( may be {@code null})
176
176
* @return the value for the {@code Location} header
177
177
* @see HttpEntity
178
178
*/
@@ -185,7 +185,7 @@ public interface RestOperations {
185
185
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
186
186
* add additional HTTP headers to the request.
187
187
* @param url the URL
188
- * @param request the Object to be POSTed, may be {@code null}
188
+ * @param request the Object to be POSTed ( may be {@code null})
189
189
* @param responseType the type of the return value
190
190
* @param uriVariables the variables to expand the template
191
191
* @return the converted object
@@ -201,7 +201,7 @@ <T> T postForObject(String url, Object request, Class<T> responseType, Object...
201
201
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
202
202
* add additional HTTP headers to the request.
203
203
* @param url the URL
204
- * @param request the Object to be POSTed, may be {@code null}
204
+ * @param request the Object to be POSTed ( may be {@code null})
205
205
* @param responseType the type of the return value
206
206
* @param uriVariables the variables to expand the template
207
207
* @return the converted object
@@ -216,7 +216,7 @@ <T> T postForObject(String url, Object request, Class<T> responseType, Map<Strin
216
216
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
217
217
* add additional HTTP headers to the request.
218
218
* @param url the URL
219
- * @param request the Object to be POSTed, may be {@code null}
219
+ * @param request the Object to be POSTed ( may be {@code null})
220
220
* @param responseType the type of the return value
221
221
* @return the converted object
222
222
* @see HttpEntity
@@ -230,11 +230,11 @@ <T> T postForObject(String url, Object request, Class<T> responseType, Map<Strin
230
230
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
231
231
* add additional HTTP headers to the request.
232
232
* @param url the URL
233
- * @param request the Object to be POSTed, may be {@code null}
233
+ * @param request the Object to be POSTed ( may be {@code null})
234
234
* @param uriVariables the variables to expand the template
235
235
* @return the converted object
236
- * @see HttpEntity
237
236
* @since 3.0.2
237
+ * @see HttpEntity
238
238
*/
239
239
<T > ResponseEntity <T > postForEntity (String url , Object request , Class <T > responseType , Object ... uriVariables )
240
240
throws RestClientException ;
@@ -246,11 +246,11 @@ <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> respons
246
246
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
247
247
* add additional HTTP headers to the request.
248
248
* @param url the URL
249
- * @param request the Object to be POSTed, may be {@code null}
249
+ * @param request the Object to be POSTed ( may be {@code null})
250
250
* @param uriVariables the variables to expand the template
251
251
* @return the converted object
252
- * @see HttpEntity
253
252
* @since 3.0.2
253
+ * @see HttpEntity
254
254
*/
255
255
<T > ResponseEntity <T > postForEntity (String url , Object request , Class <T > responseType , Map <String , ?> uriVariables )
256
256
throws RestClientException ;
@@ -261,10 +261,10 @@ <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> respons
261
261
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
262
262
* add additional HTTP headers to the request.
263
263
* @param url the URL
264
- * @param request the Object to be POSTed, may be {@code null}
264
+ * @param request the Object to be POSTed ( may be {@code null})
265
265
* @return the converted object
266
- * @see HttpEntity
267
266
* @since 3.0.2
267
+ * @see HttpEntity
268
268
*/
269
269
<T > ResponseEntity <T > postForEntity (URI url , Object request , Class <T > responseType ) throws RestClientException ;
270
270
@@ -277,7 +277,7 @@ <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> respons
277
277
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
278
278
* add additional HTTP headers to the request.
279
279
* @param url the URL
280
- * @param request the Object to be PUT, may be {@code null}
280
+ * @param request the Object to be PUT ( may be {@code null})
281
281
* @param uriVariables the variables to expand the template
282
282
* @see HttpEntity
283
283
*/
@@ -289,7 +289,7 @@ <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> respons
289
289
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
290
290
* add additional HTTP headers to the request.
291
291
* @param url the URL
292
- * @param request the Object to be PUT, may be {@code null}
292
+ * @param request the Object to be PUT ( may be {@code null})
293
293
* @param uriVariables the variables to expand the template
294
294
* @see HttpEntity
295
295
*/
@@ -300,12 +300,64 @@ <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> respons
300
300
* <p>The {@code request} parameter can be a {@link HttpEntity} in order to
301
301
* add additional HTTP headers to the request.
302
302
* @param url the URL
303
- * @param request the Object to be PUT, may be {@code null}
303
+ * @param request the Object to be PUT ( may be {@code null})
304
304
* @see HttpEntity
305
305
*/
306
306
void put (URI url , Object request ) throws RestClientException ;
307
307
308
308
309
+ // PATCH
310
+
311
+ /**
312
+ * Update a resource by PATCHing the given object to the URI template,
313
+ * and returns 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
+ * @param url the URL
318
+ * @param request the Object to be PATCHed (may be {@code null})
319
+ * @param responseType the type of the return value
320
+ * @param uriVariables the variables to expand the template
321
+ * @return the converted object
322
+ * @since 4.3.5
323
+ * @see HttpEntity
324
+ */
325
+ <T > T patchForObject (String url , Object request , Class <T > responseType , Object ... uriVariables )
326
+ throws RestClientException ;
327
+
328
+ /**
329
+ * Update a resource by PATCHing the given object to the URI template,
330
+ * and returns the representation found in the response.
331
+ * <p>URI Template variables are expanded using the given map.
332
+ * <p>The {@code request} parameter can be a {@link HttpEntity} in order to
333
+ * add additional HTTP headers to the request.
334
+ * @param url the URL
335
+ * @param request the Object to be PATCHed (may be {@code null})
336
+ * @param responseType the type of the return value
337
+ * @param uriVariables the variables to expand the template
338
+ * @return the converted object
339
+ * @since 4.3.5
340
+ * @see HttpEntity
341
+ */
342
+ <T > T patchForObject (String url , Object request , Class <T > responseType , Map <String , ?> uriVariables )
343
+ throws RestClientException ;
344
+
345
+ /**
346
+ * Update a resource by PATCHing the given object to the URL,
347
+ * and returns the representation found in the response.
348
+ * <p>The {@code request} parameter can be a {@link HttpEntity} in order to
349
+ * add additional HTTP headers to the request.
350
+ * @param url the URL
351
+ * @param request the Object to be PATCHed (may be {@code null})
352
+ * @param responseType the type of the return value
353
+ * @return the converted object
354
+ * @since 4.3.5
355
+ * @see HttpEntity
356
+ */
357
+ <T > T patchForObject (URI url , Object request , Class <T > responseType ) throws RestClientException ;
358
+
359
+
360
+
309
361
// DELETE
310
362
311
363
/**
@@ -368,7 +420,8 @@ <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> respons
368
420
* <p>URI Template variables are expanded using the given URI variables, if any.
369
421
* @param url the URL
370
422
* @param method the HTTP method (GET, POST, etc)
371
- * @param requestEntity the entity (headers and/or body) to write to the request, may be {@code null}
423
+ * @param requestEntity the entity (headers and/or body) to write to the request
424
+ * may be {@code null})
372
425
* @param responseType the type of the return value
373
426
* @param uriVariables the variables to expand in the template
374
427
* @return the response as entity
@@ -383,7 +436,8 @@ <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requ
383
436
* <p>URI Template variables are expanded using the given URI variables, if any.
384
437
* @param url the URL
385
438
* @param method the HTTP method (GET, POST, etc)
386
- * @param requestEntity the entity (headers and/or body) to write to the request, may be {@code null}
439
+ * @param requestEntity the entity (headers and/or body) to write to the request
440
+ * (may be {@code null})
387
441
* @param responseType the type of the return value
388
442
* @param uriVariables the variables to expand in the template
389
443
* @return the response as entity
@@ -397,7 +451,8 @@ <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requ
397
451
* returns the response as {@link ResponseEntity}.
398
452
* @param url the URL
399
453
* @param method the HTTP method (GET, POST, etc)
400
- * @param requestEntity the entity (headers and/or body) to write to the request, may be {@code null}
454
+ * @param requestEntity the entity (headers and/or body) to write to the request
455
+ * (may be {@code null})
401
456
* @param responseType the type of the return value
402
457
* @return the response as entity
403
458
* @since 3.0.2
@@ -416,7 +471,7 @@ <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> request
416
471
* @param url the URL
417
472
* @param method the HTTP method (GET, POST, etc)
418
473
* @param requestEntity the entity (headers and/or body) to write to the
419
- * request, may be {@code null}
474
+ * request ( may be {@code null})
420
475
* @param responseType the type of the return value
421
476
* @param uriVariables the variables to expand in the template
422
477
* @return the response as entity
@@ -435,7 +490,8 @@ <T> ResponseEntity<T> exchange(String url,HttpMethod method, HttpEntity<?> reque
435
490
* </pre>
436
491
* @param url the URL
437
492
* @param method the HTTP method (GET, POST, etc)
438
- * @param requestEntity the entity (headers and/or body) to write to the request, may be {@code null}
493
+ * @param requestEntity the entity (headers and/or body) to write to the request
494
+ * (may be {@code null})
439
495
* @param responseType the type of the return value
440
496
* @param uriVariables the variables to expand in the template
441
497
* @return the response as entity
@@ -454,7 +510,8 @@ <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requ
454
510
* </pre>
455
511
* @param url the URL
456
512
* @param method the HTTP method (GET, POST, etc)
457
- * @param requestEntity the entity (headers and/or body) to write to the request, may be {@code null}
513
+ * @param requestEntity the entity (headers and/or body) to write to the request
514
+ * (may be {@code null})
458
515
* @param responseType the type of the return value
459
516
* @return the response as entity
460
517
* @since 3.2
0 commit comments