接口 ClientRequest.Builder
- 所有已知实现类:
DefaultClientRequestBuilder
- 封闭接口:
- ClientRequest
public static interface ClientRequest.Builder
Defines a builder for a request.
-
方法概要
修饰符和类型方法说明Set the attribute with the given name to the given value.attributes(Consumer<Map<String, Object>> attributesConsumer) Manipulate the request attributes with the given consumer.body(BodyInserter<?, ? super ClientHttpRequest> inserter) Set the body of the request to the givenBodyInserter.<S,P extends org.reactivestreams.Publisher<S>>
ClientRequest.Builderbody(P publisher, cn.taketoday.core.ParameterizedTypeReference<S> typeReference) Set the body of the request to the givenPublisherand return it.<S,P extends org.reactivestreams.Publisher<S>>
ClientRequest.BuilderSet the body of the request to the givenPublisherand return it.build()Build the request.Add a cookie with the given name and value(s).Manipulate this request's cookies with the given consumer.Add the given header value(s) under the given name.headers(Consumer<HttpHeaders> headersConsumer) Manipulate this request's headers with the given consumer.httpRequest(Consumer<ClientHttpRequest> requestConsumer) Callback for access to theClientHttpRequestthat in turn provides access to the native request of the underlying HTTP library.method(HttpMethod method) Set the method of the request.Set the url of the request.
-
方法详细资料
-
method
Set the method of the request.- 参数:
method- the new method- 返回:
- this builder
-
url
Set the url of the request.- 参数:
url- the new url- 返回:
- this builder
-
header
Add the given header value(s) under the given name.- 参数:
headerName- the header nameheaderValues- the header value(s)- 返回:
- this builder
- 另请参阅:
-
headers
Manipulate this request's headers with the given consumer. The headers provided to the consumer are "live", so that the consumer can be used to overwrite existing header values, remove values, or use any of the otherHttpHeadersmethods.- 参数:
headersConsumer- a function that consumes theHttpHeaders- 返回:
- this builder
-
cookie
Add a cookie with the given name and value(s).- 参数:
name- the cookie namevalues- the cookie value(s)- 返回:
- this builder
-
cookies
ClientRequest.Builder cookies(Consumer<cn.taketoday.util.MultiValueMap<String, String>> cookiesConsumer) Manipulate this request's cookies with the given consumer. The map provided to the consumer is "live", so that the consumer can be used to overwrite existing cookie values, remove cookies, or use any of the otherMultiValueMapmethods.- 参数:
cookiesConsumer- a function that consumes the cookies map- 返回:
- this builder
-
body
Set the body of the request to the givenBodyInserter.- 参数:
inserter- theBodyInserterthat writes to the request- 返回:
- this builder
-
body
<S,P extends org.reactivestreams.Publisher<S>> ClientRequest.Builder body(P publisher, Class<S> elementClass) Set the body of the request to the givenPublisherand return it.- 类型参数:
S- the type of the elements contained in the publisherP- the type of thePublisher- 参数:
publisher- thePublisherto write to the requestelementClass- the class of elements contained in the publisher- 返回:
- the built request
-
body
<S,P extends org.reactivestreams.Publisher<S>> ClientRequest.Builder body(P publisher, cn.taketoday.core.ParameterizedTypeReference<S> typeReference) Set the body of the request to the givenPublisherand return it.- 类型参数:
S- the type of the elements contained in the publisherP- the type of thePublisher- 参数:
publisher- thePublisherto write to the requesttypeReference- a type reference describing the elements contained in the publisher- 返回:
- the built request
-
attribute
Set the attribute with the given name to the given value.- 参数:
name- the name of the attribute to addvalue- the value of the attribute to add- 返回:
- this builder
-
attributes
Manipulate the request attributes with the given consumer. The attributes provided to the consumer are "live", so that the consumer can be used to inspect attributes, remove attributes, or use any of the other map-provided methods.- 参数:
attributesConsumer- a function that consumes the attributes- 返回:
- this builder
-
httpRequest
Callback for access to theClientHttpRequestthat in turn provides access to the native request of the underlying HTTP library. This could be useful for setting advanced, per-request options that exposed by the underlying library.- 参数:
requestConsumer- a consumer to access theClientHttpRequestwith- 返回:
- this builder
-
build
ClientRequest build()Build the request.
-