接口 ClientRequest.Builder

所有已知实现类:
DefaultClientRequestBuilder
封闭接口:
ClientRequest

public static interface ClientRequest.Builder
Defines a builder for a 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

      ClientRequest.Builder header(String headerName, String... headerValues)
      Add the given header value(s) under the given name.
      参数:
      headerName - the header name
      headerValues - the header value(s)
      返回:
      this builder
      另请参阅:
    • headers

      ClientRequest.Builder headers(Consumer<HttpHeaders> headersConsumer)
      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 other HttpHeaders methods.
      参数:
      headersConsumer - a function that consumes the HttpHeaders
      返回:
      this builder
    • cookie

      ClientRequest.Builder cookie(String name, String... values)
      Add a cookie with the given name and value(s).
      参数:
      name - the cookie name
      values - 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 other MultiValueMap methods.
      参数:
      cookiesConsumer - a function that consumes the cookies map
      返回:
      this builder
    • body

      Set the body of the request to the given BodyInserter.
      参数:
      inserter - the BodyInserter that 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 given Publisher and return it.
      类型参数:
      S - the type of the elements contained in the publisher
      P - the type of the Publisher
      参数:
      publisher - the Publisher to write to the request
      elementClass - 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 given Publisher and return it.
      类型参数:
      S - the type of the elements contained in the publisher
      P - the type of the Publisher
      参数:
      publisher - the Publisher to write to the request
      typeReference - a type reference describing the elements contained in the publisher
      返回:
      the built request
    • attribute

      ClientRequest.Builder attribute(String name, Object value)
      Set the attribute with the given name to the given value.
      参数:
      name - the name of the attribute to add
      value - the value of the attribute to add
      返回:
      this builder
    • attributes

      ClientRequest.Builder attributes(Consumer<Map<String,Object>> attributesConsumer)
      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

      ClientRequest.Builder httpRequest(Consumer<ClientHttpRequest> requestConsumer)
      Callback for access to the ClientHttpRequest that 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 the ClientHttpRequest with
      返回:
      this builder
    • build

      ClientRequest build()
      Build the request.