接口 WebClient
public interface WebClient
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()
orcreate(String)
, orbuilder()
to prepare an instance.For examples with a response body see:
For examples with a request body see:
- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev, Arjen Poutsma, Sebastien Deleuze, Brian Clozel
嵌套类概要
嵌套类 修饰符和类型 接口 说明 static interface
WebClient.Builder
A mutable builder for creating aWebClient
.static interface
WebClient.RequestBodySpec
Contract for specifying request headers and body leading up to the exchange.static interface
WebClient.RequestBodyUriSpec
Contract for specifying request headers, body and URI for a request.static interface
WebClient.RequestHeadersSpec<S extends WebClient.RequestHeadersSpec<S>>
Contract for specifying request headers leading up to the exchange.static interface
WebClient.RequestHeadersUriSpec<S extends WebClient.RequestHeadersSpec<S>>
Contract for specifying request headers and URI for a request.static interface
WebClient.ResponseSpec
Contract for specifying response operations following the exchange.static interface
WebClient.UriSpec<S extends WebClient.RequestHeadersSpec<?>>
Contract for specifying the URI for a request.
方法概要
所有方法 静态方法 实例方法 抽象方法 修饰符和类型 方法 说明 static WebClient.Builder
builder()
Obtain aWebClient
builder.static WebClient
create()
Create a newWebClient
with Reactor Netty by default.static WebClient
create(String baseUrl)
Variant ofcreate()
that accepts a default base URL.WebClient.RequestHeadersUriSpec<?>
delete()
Start building an HTTP DELETE request.WebClient.RequestHeadersUriSpec<?>
get()
Start building an HTTP GET request.WebClient.RequestHeadersUriSpec<?>
head()
Start building an HTTP HEAD request.WebClient.RequestBodyUriSpec
method(HttpMethod method)
Start building a request for the givenHttpMethod
.WebClient.Builder
mutate()
Return a builder to create a newWebClient
whose settings are replicated from the currentWebClient
.WebClient.RequestHeadersUriSpec<?>
options()
Start building an HTTP OPTIONS request.WebClient.RequestBodyUriSpec
patch()
Start building an HTTP PATCH request.WebClient.RequestBodyUriSpec
post()
Start building an HTTP POST request.WebClient.RequestBodyUriSpec
put()
Start building an HTTP PUT request.
方法详细资料
get
WebClient.RequestHeadersUriSpec<?> get()
Start building an HTTP GET request.- 返回:
- a spec for specifying the target URL
head
WebClient.RequestHeadersUriSpec<?> head()
Start building an HTTP HEAD request.- 返回:
- a spec for specifying the target URL
post
WebClient.RequestBodyUriSpec post()
Start building an HTTP POST request.- 返回:
- a spec for specifying the target URL
put
WebClient.RequestBodyUriSpec put()
Start building an HTTP PUT request.- 返回:
- a spec for specifying the target URL
patch
WebClient.RequestBodyUriSpec patch()
Start building an HTTP PATCH request.- 返回:
- a spec for specifying the target URL
delete
WebClient.RequestHeadersUriSpec<?> delete()
Start building an HTTP DELETE request.- 返回:
- a spec for specifying the target URL
options
WebClient.RequestHeadersUriSpec<?> options()
Start building an HTTP OPTIONS request.- 返回:
- a spec for specifying the target URL
method
WebClient.RequestBodyUriSpec method(HttpMethod method)
Start building a request for the givenHttpMethod
.- 返回:
- a spec for specifying the target URL
mutate
WebClient.Builder mutate()
Return a builder to create a newWebClient
whose settings are replicated from the currentWebClient
.
create
static WebClient create()
Create a newWebClient
with Reactor Netty by default.- 另请参阅:
create(String)
,builder()
create
static WebClient create(String baseUrl)
Variant ofcreate()
that accepts a default base URL. For more details seeBuilder.baseUrl(String)
.- 参数:
baseUrl
- the base URI for all requests- 另请参阅:
builder()
builder
static WebClient.Builder builder()
Obtain aWebClient
builder.