Top Description Inners Methods
org.springframework.web.reactive.function.client

public Interface WebClient

Known Direct Implementers
org.springframework.web.reactive.function.client.DefaultWebClient
Imports
java.net.URI, java.nio.charset.Charset, java.time.ZonedDateTime, java.util.List, .Map, java.util.function.Consumer, .Function, .IntPredicate, .Predicate, io.micrometer.observation.ObservationConvention, .ObservationRegistry, org.reactivestreams.Publisher, reactor.core.publisher.Flux, .Mono, reactor.util.context.Context, org.springframework.core.ParameterizedTypeReference, .ReactiveAdapterRegistry, org.springframework.http.HttpHeaders, .HttpMethod, .HttpStatusCode, .MediaType, .ResponseEntity, org.springframework.http.client.reactive.ClientHttpConnector, .ClientHttpRequest, .ClientHttpResponse, org.springframework.http.codec.ClientCodecConfigurer, org.springframework.util.MultiValueMap, org.springframework.web.reactive.function.BodyExtractor, .BodyInserter, .BodyInserters, org.springframework.web.util.DefaultUriBuilderFactory, .UriBuilder, .UriBuilderFactory

Non-blocking, reactive client to perform HTTP requests, exposing a fluent, reactive API over underlying HTTP client libraries such as Reactor Netty.

Use static factory methods create() or create(String), or WebClient#builder() to prepare an instance.

For examples with a response body see:

For examples with a request body see:

Authors
Rossen Stoyanchev, Arjen Poutsma, Sebastien Deleuze, Brian Clozel
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
WebClient.Builder

A mutable builder for creating a WebClient.

public static interface
WebClient.RequestBodySpec

Contract for specifying request headers and body leading up to the exchange.

public static interface
WebClient.RequestBodyUriSpec

Contract for specifying request headers, body and URI for a request.

public static interface
WebClient.RequestHeadersSpec<
a self reference to the spec type
S extends WebClient.RequestHeadersSpec<S>
>

Contract for specifying request headers leading up to the exchange.

public static interface
WebClient.RequestHeadersUriSpec<
a self reference to the spec type
S extends WebClient.RequestHeadersSpec<S>
>

Contract for specifying request headers and URI for a request.

public static interface
WebClient.ResponseSpec

Contract for specifying response operations following the exchange.

public static interface
WebClient.UriSpec<
a self reference to the spec type
S extends WebClient.RequestHeadersSpec<?>
>

Contract for specifying the URI for a request.

Method Summary

Modifier and TypeMethod and Description
public static WebClient.Builder
builder()

Obtain a WebClient builder.

public static WebClient
create()

Create a new WebClient with Reactor Netty by default.

public static WebClient
create(String
the base URI for all requests
baseUrl
)

Variant of create() that accepts a default base URL.

public WebClient.RequestHeadersUriSpec<?>

Returns:

a spec for specifying the target URL
delete
()

Start building an HTTP DELETE request.

public WebClient.RequestHeadersUriSpec<?>

Returns:

a spec for specifying the target URL
get
()

Start building an HTTP GET request.

public WebClient.RequestHeadersUriSpec<?>

Returns:

a spec for specifying the target URL
head
()

Start building an HTTP HEAD request.

public WebClient.RequestBodyUriSpec

Returns:

a spec for specifying the target URL
method
(HttpMethod method)

Start building a request for the given HttpMethod.

public WebClient.Builder
mutate()

Return a builder to create a new WebClient whose settings are replicated from the current WebClient.

public WebClient.RequestHeadersUriSpec<?>

Returns:

a spec for specifying the target URL
options
()

Start building an HTTP OPTIONS request.

public WebClient.RequestBodyUriSpec

Returns:

a spec for specifying the target URL
patch
()

Start building an HTTP PATCH request.

public WebClient.RequestBodyUriSpec

Returns:

a spec for specifying the target URL
post
()

Start building an HTTP POST request.

public WebClient.RequestBodyUriSpec

Returns:

a spec for specifying the target URL
put
()

Start building an HTTP PUT request.