类 HttpRequestBuilder

java.lang.Object
io.github.wooenrico.http.common.HttpRequestBuilder

public class HttpRequestBuilder extends Object
Builder for HttpRequest objects.
  • 构造器详细资料

    • HttpRequestBuilder

      public HttpRequestBuilder()
  • 方法详细资料

    • url

      public HttpRequestBuilder url(String url)
      Sets the URL for the HttpRequest.
      参数:
      url - the URL
      返回:
      the builder
    • urlParam

      public HttpRequestBuilder urlParam(String key, String value)
      Sets the URL parameter for the HttpRequest.
      参数:
      key - header key
      value - header value
      返回:
      the builder
    • method

      public HttpRequestBuilder method(Method method)
      Sets the HTTP method for the HttpRequest.
      参数:
      method - the HTTP method
      返回:
      the builder
    • body

      public HttpRequestBuilder body(byte[] body)
      Sets the body for the HttpRequest.
      参数:
      body - the body bytes
      返回:
      the builder
    • headers

      public HttpRequestBuilder headers(Map<String,String> headers)
      Sets the headers for the HttpRequest.
      参数:
      headers - the headers map
      返回:
      the builder
    • header

      public HttpRequestBuilder header(String key, String value)
      Adds a header to the HttpRequest.
      参数:
      key - header key
      value - header value
      返回:
      the builder
    • keepAlive

      public HttpRequestBuilder keepAlive(boolean isKeepAlive)
      Sets the header for the HttpRequest.
      参数:
      isKeepAlive - is keep alive
      返回:
      the builder
    • build

      public HttpRequest build()
      Builds the HttpRequest.
      返回:
      the HttpRequest