org.apache.hc.client5.http.fluent

## Class Request

- java.lang.Object
- - org.apache.hc.client5.http.fluent.Request

-     public class Request
      extends Object

  HTTP request used by the fluent facade.
  Since:
    4.2

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DATE_FORMAT` Deprecated. This attribute is no longer supported as a part of the public API.
    `static Locale` | `DATE_LOCALE` Deprecated. This attribute is no longer supported as a part of the public API.
    `static TimeZone` | `TIME_ZONE` Deprecated. This attribute is no longer supported as a part of the public API.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Request` | `addHeader(org.apache.hc.core5.http.Header header)`
    `Request` | `addHeader(String name, String value)`
    `Request` | `body(org.apache.hc.core5.http.HttpEntity entity)`
    `Request` | `bodyByteArray(byte[] b)`
    `Request` | `bodyByteArray(byte[] b, org.apache.hc.core5.http.ContentType contentType)`
    `Request` | `bodyByteArray(byte[] b, int off, int len)`
    `Request` | `bodyByteArray(byte[] b, int off, int len, org.apache.hc.core5.http.ContentType contentType)`
    `Request` | `bodyFile(File file, org.apache.hc.core5.http.ContentType contentType)`
    `Request` | `bodyForm(Iterable<? extends org.apache.hc.core5.http.NameValuePair> formParams)`
    `Request` | `bodyForm(Iterable<? extends org.apache.hc.core5.http.NameValuePair> formParams, Charset charset)`
    `Request` | `bodyForm(org.apache.hc.core5.http.NameValuePair... formParams)`
    `Request` | `bodyStream(InputStream inStream)`
    `Request` | `bodyStream(InputStream inStream, org.apache.hc.core5.http.ContentType contentType)`
    `Request` | `bodyString(String s, org.apache.hc.core5.http.ContentType contentType)`
    `Request` | `connectTimeout(org.apache.hc.core5.util.Timeout timeout)`
    `static Request` | `create(org.apache.hc.core5.http.Method method, URI uri)`
    `static Request` | `create(String methodName, String uri)`
    `static Request` | `create(String methodName, URI uri)`
    `static Request` | `delete(String uri)`
    `static Request` | `delete(URI uri)`
    `Response` | `execute()`
    `Response` | `execute(CloseableHttpClient client)`
    `static Request` | `get(String uri)`
    `static Request` | `get(URI uri)`
    `static Request` | `head(String uri)`
    `static Request` | `head(URI uri)`
    `static Request` | `options(String uri)`
    `static Request` | `options(URI uri)`
    `static Request` | `patch(String uri)`
    `static Request` | `patch(URI uri)`
    `static Request` | `post(String uri)`
    `static Request` | `post(URI uri)`
    `static Request` | `put(String uri)`
    `static Request` | `put(URI uri)`
    `Request` | `removeHeader(org.apache.hc.core5.http.Header header)`
    `Request` | `removeHeaders(String name)`
    `Request` | `responseTimeout(org.apache.hc.core5.util.Timeout timeout)`
    `Request` | `setCacheControl(String cacheControl)`
    `Request` | `setDate(Date date)` Deprecated. Use `setDate(Instant)`
    `Request` | `setDate(Instant instant)`
    `Request` | `setHeader(org.apache.hc.core5.http.Header header)`
    `Request` | `setHeader(String name, String value)`
    `Request` | `setHeaders(org.apache.hc.core5.http.Header... headers)`
    `Request` | `setIfModifiedSince(Date date)` Deprecated. Use `setIfModifiedSince(Instant)`
    `Request` | `setIfModifiedSince(Instant instant)`
    `Request` | `setIfUnmodifiedSince(Date date)` Deprecated. Use `setIfUnmodifiedSince(Instant)`
    `Request` | `setIfUnmodifiedSince(Instant instant)`
    `String` | `toString()`
    `static Request` | `trace(String uri)`
    `static Request` | `trace(URI uri)`
    `Request` | `useExpectContinue()`
    `Request` | `userAgent(String agent)`
    `Request` | `version(org.apache.hc.core5.http.HttpVersion version)`
    `Request` | `viaProxy(org.apache.hc.core5.http.HttpHost proxy)`
    `Request` | `viaProxy(String proxy)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DATE_FORMAT

          @Deprecated
          public static final String DATE_FORMAT

      Deprecated. This attribute is no longer supported as a part of the public API.
      See Also:
        Constant Field Values

    - #### DATE_LOCALE

          @Deprecated
          public static final Locale DATE_LOCALE

      Deprecated. This attribute is no longer supported as a part of the public API.

    - #### TIME_ZONE

          @Deprecated
          public static final TimeZone TIME_ZONE

      Deprecated. This attribute is no longer supported as a part of the public API.

  - ### Method Detail

    - #### create

          public static Request create(org.apache.hc.core5.http.Method method,
                                       URI uri)

    - #### create

          public static Request create(String methodName,
                                       String uri)

    - #### create

          public static Request create(String methodName,
                                       URI uri)

    - #### get

          public static Request get(URI uri)

    - #### get

          public static Request get(String uri)

    - #### head

          public static Request head(URI uri)

    - #### head

          public static Request head(String uri)

    - #### post

          public static Request post(URI uri)

    - #### post

          public static Request post(String uri)

    - #### patch

          public static Request patch(URI uri)

    - #### patch

          public static Request patch(String uri)

    - #### put

          public static Request put(URI uri)

    - #### put

          public static Request put(String uri)

    - #### trace

          public static Request trace(URI uri)

    - #### trace

          public static Request trace(String uri)

    - #### delete

          public static Request delete(URI uri)

    - #### delete

          public static Request delete(String uri)

    - #### options

          public static Request options(URI uri)

    - #### options

          public static Request options(String uri)

    - #### execute

          public Response execute()
                           throws IOException

      Throws:
        `IOException`

    - #### execute

          public Response execute(CloseableHttpClient client)
                           throws IOException

      Throws:
        `IOException`

    - #### addHeader

          public Request addHeader(org.apache.hc.core5.http.Header header)

    - #### setHeader

          public Request setHeader(org.apache.hc.core5.http.Header header)

      Returns:
        this instance.
      Since:
        4.3

    - #### addHeader

          public Request addHeader(String name,
                                   String value)

    - #### setHeader

          public Request setHeader(String name,
                                   String value)

      Returns:
        this instance.
      Since:
        4.3

    - #### removeHeader

          public Request removeHeader(org.apache.hc.core5.http.Header header)

    - #### removeHeaders

          public Request removeHeaders(String name)

    - #### setHeaders

          public Request setHeaders(org.apache.hc.core5.http.Header... headers)

    - #### setCacheControl

          public Request setCacheControl(String cacheControl)

    - #### setDate

          @Deprecated
          public Request setDate(Date date)

      Deprecated. Use `setDate(Instant)`
      Returns:
        this instance.

    - #### setIfModifiedSince

          @Deprecated
          public Request setIfModifiedSince(Date date)

      Deprecated. Use `setIfModifiedSince(Instant)`
      Returns:
        this instance.

    - #### setIfUnmodifiedSince

          @Deprecated
          public Request setIfUnmodifiedSince(Date date)

      Deprecated. Use `setIfUnmodifiedSince(Instant)`
      Returns:
        this instance.

    - #### setDate

          public Request setDate(Instant instant)

    - #### setIfModifiedSince

          public Request setIfModifiedSince(Instant instant)

    - #### setIfUnmodifiedSince

          public Request setIfUnmodifiedSince(Instant instant)

    - #### version

          public Request version(org.apache.hc.core5.http.HttpVersion version)

    - #### useExpectContinue

          public Request useExpectContinue()

    - #### userAgent

          public Request userAgent(String agent)

    - #### connectTimeout

          public Request connectTimeout(org.apache.hc.core5.util.Timeout timeout)

    - #### responseTimeout

          public Request responseTimeout(org.apache.hc.core5.util.Timeout timeout)

    - #### viaProxy

          public Request viaProxy(org.apache.hc.core5.http.HttpHost proxy)

    - #### viaProxy

          public Request viaProxy(String proxy)

      Returns:
        this instance.
      Since:
        4.4

    - #### body

          public Request body(org.apache.hc.core5.http.HttpEntity entity)

    - #### bodyForm

          public Request bodyForm(Iterable<? extends org.apache.hc.core5.http.NameValuePair> formParams,
                                  Charset charset)

    - #### bodyForm

          public Request bodyForm(Iterable<? extends org.apache.hc.core5.http.NameValuePair> formParams)

    - #### bodyForm

          public Request bodyForm(org.apache.hc.core5.http.NameValuePair... formParams)

    - #### bodyString

          public Request bodyString(String s,
                                    org.apache.hc.core5.http.ContentType contentType)

    - #### bodyFile

          public Request bodyFile(File file,
                                  org.apache.hc.core5.http.ContentType contentType)

    - #### bodyByteArray

          public Request bodyByteArray(byte[] b)

    - #### bodyByteArray

          public Request bodyByteArray(byte[] b,
                                       org.apache.hc.core5.http.ContentType contentType)

      Returns:
        this instance.
      Since:
        4.4

    - #### bodyByteArray

          public Request bodyByteArray(byte[] b,
                                       int off,
                                       int len)

    - #### bodyByteArray

          public Request bodyByteArray(byte[] b,
                                       int off,
                                       int len,
                                       org.apache.hc.core5.http.ContentType contentType)

      Returns:
        this instance.
      Since:
        4.4

    - #### bodyStream

          public Request bodyStream(InputStream inStream)

    - #### bodyStream

          public Request bodyStream(InputStream inStream,
                                    org.apache.hc.core5.http.ContentType contentType)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.