Browse Source

Merge branch '6.2.x'

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

Loading…
Cancel
Save