|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -49,13 +49,17 @@ import org.springframework.web.util.UriBuilderFactory; |
|
|
|
* <p>Use static factory methods {@link #create()} or {@link #create(String)}, |
|
|
|
* <p>Use static factory methods {@link #create()} or {@link #create(String)}, |
|
|
|
* or {@link WebClient#builder()} to prepare an instance. |
|
|
|
* or {@link WebClient#builder()} to prepare an instance. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>For examples with a response body see |
|
|
|
* <p>For examples with a response body see: |
|
|
|
* {@link RequestHeadersSpec#retrieve() retrieve()} and |
|
|
|
* <ul> |
|
|
|
* {@link RequestHeadersSpec#exchange() exchange()}. |
|
|
|
* <li>{@link RequestHeadersSpec#retrieve() retrieve()} |
|
|
|
* For examples with a request body see |
|
|
|
* <li>{@link RequestHeadersSpec#exchange() exchange()} |
|
|
|
* {@link RequestBodySpec#body(Publisher, Class) body(Publisher,Class)}, |
|
|
|
* </ul> |
|
|
|
* {@link RequestBodySpec#syncBody(Object) syncBody(Object)}, and |
|
|
|
* <p>For examples with a request body see: |
|
|
|
* {@link RequestBodySpec#body(BodyInserter) body(BodyInserter)}. |
|
|
|
* <ul> |
|
|
|
|
|
|
|
* <li>{@link RequestBodySpec#body(Publisher, Class) body(Publisher,Class)} |
|
|
|
|
|
|
|
* <li>{@link RequestBodySpec#syncBody(Object) syncBody(Object)} |
|
|
|
|
|
|
|
* <li>{@link RequestBodySpec#body(BodyInserter) body(BodyInserter)} |
|
|
|
|
|
|
|
* </ul> |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Rossen Stoyanchev |
|
|
|
* @author Rossen Stoyanchev |
|
|
|
* @author Arjen Poutsma |
|
|
|
* @author Arjen Poutsma |
|
|
|
@ -64,57 +68,57 @@ import org.springframework.web.util.UriBuilderFactory; |
|
|
|
public interface WebClient { |
|
|
|
public interface WebClient { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepare an HTTP GET request. |
|
|
|
* Start building an HTTP GET request. |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
RequestHeadersUriSpec<?> get(); |
|
|
|
RequestHeadersUriSpec<?> get(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepare an HTTP HEAD request. |
|
|
|
* Start building an HTTP HEAD request. |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
RequestHeadersUriSpec<?> head(); |
|
|
|
RequestHeadersUriSpec<?> head(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepare an HTTP POST request. |
|
|
|
* Start building an HTTP POST request. |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
RequestBodyUriSpec post(); |
|
|
|
RequestBodyUriSpec post(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepare an HTTP PUT request. |
|
|
|
* Start building an HTTP PUT request. |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
RequestBodyUriSpec put(); |
|
|
|
RequestBodyUriSpec put(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepare an HTTP PATCH request. |
|
|
|
* Start building an HTTP PATCH request. |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
RequestBodyUriSpec patch(); |
|
|
|
RequestBodyUriSpec patch(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepare an HTTP DELETE request. |
|
|
|
* Start building an HTTP DELETE request. |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
RequestHeadersUriSpec<?> delete(); |
|
|
|
RequestHeadersUriSpec<?> delete(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepare an HTTP OPTIONS request. |
|
|
|
* Start building an HTTP OPTIONS request. |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
RequestHeadersUriSpec<?> options(); |
|
|
|
RequestHeadersUriSpec<?> options(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Prepare a request for the specified {@code HttpMethod}. |
|
|
|
* Start building a request for the given {@code HttpMethod}. |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
* @return a spec for specifying the target URL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
RequestBodyUriSpec method(HttpMethod method); |
|
|
|
RequestBodyUriSpec method(HttpMethod method); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return a builder for a new {@code WebClient} with properties replicated |
|
|
|
* Return a builder to create a new {@code WebClient} whose settings are |
|
|
|
* from the current {@code WebClient} instance, but without affecting it. |
|
|
|
* replicated from the current {@code WebClient}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Builder mutate(); |
|
|
|
Builder mutate(); |
|
|
|
|
|
|
|
|
|
|
|
@ -122,7 +126,7 @@ public interface WebClient { |
|
|
|
// Static, factory methods
|
|
|
|
// Static, factory methods
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a new {@code WebClient} with a Reactor Netty connector. |
|
|
|
* Create a new {@code WebClient} with Reactor Netty by default. |
|
|
|
* @see #create(String) |
|
|
|
* @see #create(String) |
|
|
|
* @see #builder() |
|
|
|
* @see #builder() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -131,7 +135,7 @@ public interface WebClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A variant of {@link #create()} that accepts a default base URL. For more |
|
|
|
* Variant of {@link #create()} that accepts a default base URL. For more |
|
|
|
* details see {@link Builder#baseUrl(String) Builder.baseUrl(String)}. |
|
|
|
* details see {@link Builder#baseUrl(String) Builder.baseUrl(String)}. |
|
|
|
* @param baseUrl the base URI for all requests |
|
|
|
* @param baseUrl the base URI for all requests |
|
|
|
* @see #builder() |
|
|
|
* @see #builder() |
|
|
|
@ -256,19 +260,6 @@ public interface WebClient { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Builder defaultCookies(Consumer<MultiValueMap<String, String>> cookiesConsumer); |
|
|
|
Builder defaultCookies(Consumer<MultiValueMap<String, String>> cookiesConsumer); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Configure the {@link ClientHttpConnector} to use. |
|
|
|
|
|
|
|
* <p>By default an instance of |
|
|
|
|
|
|
|
* {@link org.springframework.http.client.reactive.ReactorClientHttpConnector |
|
|
|
|
|
|
|
* ReactorClientHttpConnector} is created if this is not set. However a |
|
|
|
|
|
|
|
* shared instance may be passed instead, e.g. for use with multiple |
|
|
|
|
|
|
|
* {@code WebClient}'s targeting different base URIs. |
|
|
|
|
|
|
|
* @param connector the connector to use |
|
|
|
|
|
|
|
* @see #exchangeStrategies(ExchangeStrategies) |
|
|
|
|
|
|
|
* @see #exchangeFunction(ExchangeFunction) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
Builder clientConnector(ClientHttpConnector connector); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Add the given filter to the filter chain. |
|
|
|
* Add the given filter to the filter chain. |
|
|
|
* @param filter the filter to be added to the chain |
|
|
|
* @param filter the filter to be added to the chain |
|
|
|
@ -276,8 +267,8 @@ public interface WebClient { |
|
|
|
Builder filter(ExchangeFilterFunction filter); |
|
|
|
Builder filter(ExchangeFilterFunction filter); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Manipulate the filters with the given consumer. The |
|
|
|
* Manipulate the filters with the given consumer. The list provided to |
|
|
|
* list provided to the consumer is "live", so that the consumer can be used to remove |
|
|
|
* the consumer is "live", so that the consumer can be used to remove |
|
|
|
* filters, change ordering, etc. |
|
|
|
* filters, change ordering, etc. |
|
|
|
* @param filtersConsumer a function that consumes the filter list |
|
|
|
* @param filtersConsumer a function that consumes the filter list |
|
|
|
* @return this builder |
|
|
|
* @return this builder |
|
|
|
@ -285,34 +276,40 @@ public interface WebClient { |
|
|
|
Builder filters(Consumer<List<ExchangeFilterFunction>> filtersConsumer); |
|
|
|
Builder filters(Consumer<List<ExchangeFilterFunction>> filtersConsumer); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Provide a pre-configured {@link ExchangeFunction} instance. This is |
|
|
|
* Configure the {@link ClientHttpConnector} to use. This is useful for |
|
|
|
* an alternative to and effectively overrides the following: |
|
|
|
* plugging in and/or customizing options of the underlying HTTP client |
|
|
|
* <ul> |
|
|
|
* library (e.g. SSL). |
|
|
|
* <li>{@link #clientConnector(ClientHttpConnector)} |
|
|
|
* <p>By default this is set to |
|
|
|
* <li>{@link #exchangeStrategies(ExchangeStrategies)}. |
|
|
|
* {@link org.springframework.http.client.reactive.ReactorClientHttpConnector |
|
|
|
* </ul> |
|
|
|
* ReactorClientHttpConnector}. |
|
|
|
* @param exchangeFunction the exchange function to use |
|
|
|
* @param connector the connector to use |
|
|
|
* @see #clientConnector(ClientHttpConnector) |
|
|
|
|
|
|
|
* @see #exchangeStrategies(ExchangeStrategies) |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Builder exchangeFunction(ExchangeFunction exchangeFunction); |
|
|
|
Builder clientConnector(ClientHttpConnector connector); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Configure the {@link ExchangeStrategies} to use. |
|
|
|
* Configure the {@link ExchangeStrategies} to use. |
|
|
|
* <p>By default {@link ExchangeStrategies#withDefaults()} is used. |
|
|
|
* <p>By default this is obtained from {@link ExchangeStrategies#withDefaults()}. |
|
|
|
* @param strategies the strategies to use |
|
|
|
* @param strategies the strategies to use |
|
|
|
* @see #clientConnector(ClientHttpConnector) |
|
|
|
|
|
|
|
* @see #exchangeFunction(ExchangeFunction) |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Builder exchangeStrategies(ExchangeStrategies strategies); |
|
|
|
Builder exchangeStrategies(ExchangeStrategies strategies); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Clone this {@code WebClient.Builder} |
|
|
|
* Provide an {@link ExchangeFunction} pre-configured with |
|
|
|
|
|
|
|
* {@link ClientHttpConnector} and {@link ExchangeStrategies}. |
|
|
|
|
|
|
|
* <p>This is an alternative to, and effectively overrides |
|
|
|
|
|
|
|
* {@link #clientConnector}, and {@link #exchangeStrategies}. |
|
|
|
|
|
|
|
* @param exchangeFunction the exchange function to use |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
Builder exchangeFunction(ExchangeFunction exchangeFunction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Clone this {@code WebClient.Builder}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Builder clone(); |
|
|
|
Builder clone(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Shortcut for pre-packaged customizations to WebTest builder. |
|
|
|
* Apply the given {@code Consumer} to this builder instance. |
|
|
|
|
|
|
|
* <p>This can be useful for applying pre-packaged customizations. |
|
|
|
* @param builderConsumer the consumer to apply |
|
|
|
* @param builderConsumer the consumer to apply |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Builder apply(Consumer<Builder> builderConsumer); |
|
|
|
Builder apply(Consumer<Builder> builderConsumer); |
|
|
|
@ -327,6 +324,7 @@ public interface WebClient { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 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 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
interface UriSpec<S extends RequestHeadersSpec<?>> { |
|
|
|
interface UriSpec<S extends RequestHeadersSpec<?>> { |
|
|
|
|
|
|
|
|
|
|
|
@ -359,6 +357,7 @@ public interface WebClient { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 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 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
interface RequestHeadersSpec<S extends RequestHeadersSpec<S>> { |
|
|
|
interface RequestHeadersSpec<S extends RequestHeadersSpec<S>> { |
|
|
|
|
|
|
|
|
|
|
|
@ -387,12 +386,9 @@ public interface WebClient { |
|
|
|
S cookie(String name, String value); |
|
|
|
S cookie(String name, String value); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Manipulate the request's cookies with the given consumer. The |
|
|
|
* Provides access to every cookie declared so far with the possibility |
|
|
|
* map provided to the consumer is "live", so that the consumer can be used to |
|
|
|
* to add, replace, or remove values. |
|
|
|
* {@linkplain MultiValueMap#set(Object, Object) overwrite} existing header values, |
|
|
|
* @param cookiesConsumer the consumer to provide access to |
|
|
|
* {@linkplain MultiValueMap#remove(Object) remove} values, or use any of the other |
|
|
|
|
|
|
|
* {@link MultiValueMap} methods. |
|
|
|
|
|
|
|
* @param cookiesConsumer a function that consumes the cookies map |
|
|
|
|
|
|
|
* @return this builder |
|
|
|
* @return this builder |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
S cookies(Consumer<MultiValueMap<String, String>> cookiesConsumer); |
|
|
|
S cookies(Consumer<MultiValueMap<String, String>> cookiesConsumer); |
|
|
|
@ -422,12 +418,9 @@ public interface WebClient { |
|
|
|
S header(String headerName, String... headerValues); |
|
|
|
S header(String headerName, String... headerValues); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Manipulate the request's headers with the given consumer. The |
|
|
|
* Provides access to every header declared so far with the possibility |
|
|
|
* headers provided to the consumer are "live", so that the consumer can be used to |
|
|
|
* to add, replace, or remove values. |
|
|
|
* {@linkplain HttpHeaders#set(String, String) overwrite} existing header values, |
|
|
|
* @param headersConsumer the consumer to provide access to |
|
|
|
* {@linkplain HttpHeaders#remove(Object) remove} values, or use any of the other |
|
|
|
|
|
|
|
* {@link HttpHeaders} methods. |
|
|
|
|
|
|
|
* @param headersConsumer a function that consumes the {@code HttpHeaders} |
|
|
|
|
|
|
|
* @return this builder |
|
|
|
* @return this builder |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
S headers(Consumer<HttpHeaders> headersConsumer); |
|
|
|
S headers(Consumer<HttpHeaders> headersConsumer); |
|
|
|
@ -441,10 +434,9 @@ public interface WebClient { |
|
|
|
S attribute(String name, Object value); |
|
|
|
S attribute(String name, Object value); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Manipulate the request attributes with the given consumer. The attributes provided to |
|
|
|
* Provides access to every attribute declared so far with the |
|
|
|
* the consumer are "live", so that the consumer can be used to inspect attributes, |
|
|
|
* possibility to add, replace, or remove values. |
|
|
|
* remove attributes, or use any of the other map-provided methods. |
|
|
|
* @param attributesConsumer the consumer to provide access to |
|
|
|
* @param attributesConsumer a function that consumes the attributes |
|
|
|
|
|
|
|
* @return this builder |
|
|
|
* @return this builder |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
S attributes(Consumer<Map<String, Object>> attributesConsumer); |
|
|
|
S attributes(Consumer<Map<String, Object>> attributesConsumer); |
|
|
|
@ -474,13 +466,13 @@ public interface WebClient { |
|
|
|
* .uri("/persons/1") |
|
|
|
* .uri("/persons/1") |
|
|
|
* .accept(MediaType.APPLICATION_JSON) |
|
|
|
* .accept(MediaType.APPLICATION_JSON) |
|
|
|
* .exchange() |
|
|
|
* .exchange() |
|
|
|
* .flatMap(response -> response.bodyToMono(Person.class)); |
|
|
|
* .flatMap(response -> response.bodyToMono(Person.class)); |
|
|
|
* |
|
|
|
* |
|
|
|
* Flux<Person> flux = client.get() |
|
|
|
* Flux<Person> flux = client.get() |
|
|
|
* .uri("/persons") |
|
|
|
* .uri("/persons") |
|
|
|
* .accept(MediaType.APPLICATION_STREAM_JSON) |
|
|
|
* .accept(MediaType.APPLICATION_STREAM_JSON) |
|
|
|
* .exchange() |
|
|
|
* .exchange() |
|
|
|
* .flatMapMany(response -> response.bodyToFlux(Person.class)); |
|
|
|
* .flatMapMany(response -> response.bodyToFlux(Person.class)); |
|
|
|
* </pre> |
|
|
|
* </pre> |
|
|
|
* <p><strong>NOTE:</strong> You must always use one of the body or |
|
|
|
* <p><strong>NOTE:</strong> You must always use one of the body or |
|
|
|
* entity methods of the response to ensure resources are released. |
|
|
|
* entity methods of the response to ensure resources are released. |
|
|
|
@ -492,6 +484,9 @@ public interface WebClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Contract for specifying request headers and body leading up to the exchange. |
|
|
|
|
|
|
|
*/ |
|
|
|
interface RequestBodySpec extends RequestHeadersSpec<RequestBodySpec> { |
|
|
|
interface RequestBodySpec extends RequestHeadersSpec<RequestBodySpec> { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -527,9 +522,9 @@ public interface WebClient { |
|
|
|
* {@linkplain BodyInserters#fromPublisher Publisher inserter}. |
|
|
|
* {@linkplain BodyInserters#fromPublisher Publisher inserter}. |
|
|
|
* For example: |
|
|
|
* For example: |
|
|
|
* <p><pre> |
|
|
|
* <p><pre> |
|
|
|
* Mono<Person> personMono = ... ; |
|
|
|
* Mono<Person> personMono = ... ; |
|
|
|
* |
|
|
|
* |
|
|
|
* Mono<Void> result = client.post() |
|
|
|
* Mono<Void> result = client.post() |
|
|
|
* .uri("/persons/{id}", id) |
|
|
|
* .uri("/persons/{id}", id) |
|
|
|
* .contentType(MediaType.APPLICATION_JSON) |
|
|
|
* .contentType(MediaType.APPLICATION_JSON) |
|
|
|
* .body(personMono, Person.class) |
|
|
|
* .body(personMono, Person.class) |
|
|
|
@ -564,7 +559,7 @@ public interface WebClient { |
|
|
|
* <p><pre class="code"> |
|
|
|
* <p><pre class="code"> |
|
|
|
* Person person = ... ; |
|
|
|
* Person person = ... ; |
|
|
|
* |
|
|
|
* |
|
|
|
* Mono<Void> result = client.post() |
|
|
|
* Mono<Void> result = client.post() |
|
|
|
* .uri("/persons/{id}", id) |
|
|
|
* .uri("/persons/{id}", id) |
|
|
|
* .contentType(MediaType.APPLICATION_JSON) |
|
|
|
* .contentType(MediaType.APPLICATION_JSON) |
|
|
|
* .syncBody(person) |
|
|
|
* .syncBody(person) |
|
|
|
@ -586,13 +581,16 @@ public interface WebClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Contract for specifying response operations following the exchange. |
|
|
|
|
|
|
|
*/ |
|
|
|
interface ResponseSpec { |
|
|
|
interface ResponseSpec { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Register a custom error function that gets invoked when the given {@link HttpStatus} |
|
|
|
* Register a custom error function that gets invoked when the given {@link HttpStatus} |
|
|
|
* predicate applies. The exception returned from the function will be returned from |
|
|
|
* predicate applies. The exception returned from the function will be returned from |
|
|
|
* {@link #bodyToMono(Class)} and {@link #bodyToFlux(Class)}. |
|
|
|
* {@link #bodyToMono(Class)} and {@link #bodyToFlux(Class)}. |
|
|
|
* <p>By default, an error handler is register that throws a |
|
|
|
* <p>By default, an error handler is registered that throws a |
|
|
|
* {@link WebClientResponseException} when the response status code is 4xx or 5xx. |
|
|
|
* {@link WebClientResponseException} when the response status code is 4xx or 5xx. |
|
|
|
* @param statusPredicate a predicate that indicates whether {@code exceptionFunction} |
|
|
|
* @param statusPredicate a predicate that indicates whether {@code exceptionFunction} |
|
|
|
* applies |
|
|
|
* applies |
|
|
|
@ -648,17 +646,22 @@ public interface WebClient { |
|
|
|
* status code is 4xx or 5xx |
|
|
|
* status code is 4xx or 5xx |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
<T> Flux<T> bodyToFlux(ParameterizedTypeReference<T> typeReference); |
|
|
|
<T> Flux<T> bodyToFlux(ParameterizedTypeReference<T> typeReference); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 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>> |
|
|
|
interface RequestHeadersUriSpec<S extends RequestHeadersSpec<S>> |
|
|
|
extends UriSpec<S>, RequestHeadersSpec<S> { |
|
|
|
extends UriSpec<S>, RequestHeadersSpec<S> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Contract for specifying request headers, body and URI for a request. |
|
|
|
|
|
|
|
*/ |
|
|
|
interface RequestBodyUriSpec extends RequestBodySpec, RequestHeadersUriSpec<RequestBodySpec> { |
|
|
|
interface RequestBodyUriSpec extends RequestBodySpec, RequestHeadersUriSpec<RequestBodySpec> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|