Browse Source

Merge branch '6.2.x'

pull/34711/merge
Sam Brannen 12 months ago
parent
commit
71b6dcfa7e
  1. 11
      spring-web/src/main/java/org/springframework/web/client/RestClient.java

11
spring-web/src/main/java/org/springframework/web/client/RestClient.java

@ -494,6 +494,7 @@ public interface RestClient { @@ -494,6 +494,7 @@ public interface RestClient {
/**
* Contract for specifying the URI for a request.
*
* @param <S> a self reference to the spec type
*/
interface UriSpec<S extends RequestHeadersSpec<?>> {
@ -537,6 +538,7 @@ public interface RestClient { @@ -537,6 +538,7 @@ public interface RestClient {
/**
* Contract for specifying request headers leading up to the exchange.
*
* @param <S> a self reference to the spec type
*/
interface RequestHeadersSpec<S extends RequestHeadersSpec<S>> {
@ -730,6 +732,7 @@ public interface RestClient { @@ -730,6 +732,7 @@ public interface RestClient {
* @param exchangeFunction the function to handle the response with
* @param <T> the type the response will be transformed to
* @return the value returned from the exchange function, never {@code null}
* @since 6.2.6
*/
default <T> T exchangeForRequiredValue(RequiredValueExchangeFunction<T> exchangeFunction) {
return exchangeForRequiredValue(exchangeFunction, true);
@ -791,12 +794,14 @@ public interface RestClient { @@ -791,12 +794,14 @@ public interface RestClient {
* {@code exchangeFunction} is invoked, {@code false} to keep it open
* @param <T> the type the response will be transformed to
* @return the value returned from the exchange function, never {@code null}
* @since 6.2.6
*/
<T> T exchangeForRequiredValue(RequiredValueExchangeFunction<T> exchangeFunction, boolean close);
/**
* Defines the contract for {@link #exchange(ExchangeFunction)}.
*
* @param <T> the type the response will be transformed to
*/
@FunctionalInterface
@ -814,6 +819,8 @@ public interface RestClient { @@ -814,6 +819,8 @@ public interface RestClient {
/**
* Variant of {@link ExchangeFunction} returning a non-null required value.
*
* @since 6.2.6
* @param <T> the type the response will be transformed to
*/
@FunctionalInterface
@ -826,6 +833,7 @@ public interface RestClient { @@ -826,6 +833,7 @@ public interface RestClient {
* @return the exchanged value, never {@code null}
* @throws IOException in case of I/O errors
*/
@Override
T exchange(HttpRequest clientRequest, ConvertibleClientHttpResponse clientResponse) throws IOException;
}
@ -849,7 +857,6 @@ public interface RestClient { @@ -849,7 +857,6 @@ public interface RestClient {
* @return the body, or {@code null} if no response body was available
*/
<T> @Nullable T bodyTo(ParameterizedTypeReference<T> bodyType);
}
}
@ -1029,6 +1036,7 @@ public interface RestClient { @@ -1029,6 +1036,7 @@ public interface RestClient {
/**
* Contract for specifying request headers and URI for a request.
*
* @param <S> a self reference to the spec type
*/
interface RequestHeadersUriSpec<S extends RequestHeadersSpec<S>> extends UriSpec<S>, RequestHeadersSpec<S> {
@ -1041,5 +1049,4 @@ public interface RestClient { @@ -1041,5 +1049,4 @@ public interface RestClient {
interface RequestBodyUriSpec extends RequestBodySpec, RequestHeadersUriSpec<RequestBodySpec> {
}
}

Loading…
Cancel
Save