org.apache.hc.client5.http.classic.methods

## Class RequestBuilder

- java.lang.Object
- - org.apache.hc.client5.http.classic.methods.RequestBuilder

    public class RequestBuilder
    extends Object

Builder for `ClassicHttpRequest` instances.

Please note that this class treats parameters differently depending on composition of the request: if the request has a content entity explicitly set with `setEntity(org.apache.hc.core5.http.HttpEntity)` or it is not an entity enclosing method (such as POST or PUT), parameters will be added to the query component of the request URI. Otherwise, parameters will be added as a URL encoded `entity`.

Since:
  4.3

### Method Summary

Methods
`RequestBuilder` `addHeader(Header header)`
`RequestBuilder` `addHeader(String name, String value)`
`RequestBuilder` `addParameter(NameValuePair nvp)`
`RequestBuilder` `addParameter(String name, String value)`
`RequestBuilder` `addParameters(NameValuePair... nvps)`
`ClassicHttpRequest` `build()`
`static RequestBuilder` `copy(ClassicHttpRequest request)`
`static RequestBuilder` `create(String method)`
`static RequestBuilder` `delete()`
`static RequestBuilder` `delete(String uri)`
`static RequestBuilder` `delete(URI uri)`
`static RequestBuilder` `get()`
`static RequestBuilder` `get(String uri)`
`static RequestBuilder` `get(URI uri)`
`Charset` `getCharset()`
`RequestConfig` `getConfig()`
`HttpEntity` `getEntity()`
`Header` `getFirstHeader(String name)`
`Header[]` `getHeaders(String name)`
`Header` `getLastHeader(String name)`
`String` `getMethod()`
`List<NameValuePair>` `getParameters()`
`URI` `getUri()`
`ProtocolVersion` `getVersion()`
`static RequestBuilder` `head()`
`static RequestBuilder` `head(String uri)`
`static RequestBuilder` `head(URI uri)`
`static RequestBuilder` `options()`
`static RequestBuilder` `options(String uri)`
`static RequestBuilder` `options(URI uri)`
`static RequestBuilder` `patch()`
`static RequestBuilder` `patch(String uri)`
`static RequestBuilder` `patch(URI uri)`
`static RequestBuilder` `post()`
`static RequestBuilder` `post(String uri)`
`static RequestBuilder` `post(URI uri)`
`static RequestBuilder` `put()`
`static RequestBuilder` `put(String uri)`
`static RequestBuilder` `put(URI uri)`
`RequestBuilder` `removeHeader(Header header)`
`RequestBuilder` `removeHeaders(String name)`
`RequestBuilder` `setCharset(Charset charset)`
`RequestBuilder` `setConfig(RequestConfig config)`
`RequestBuilder` `setEntity(HttpEntity entity)`
`RequestBuilder` `setHeader(Header header)`
`RequestBuilder` `setHeader(String name, String value)`
`RequestBuilder` `setUri(String uri)`
`RequestBuilder` `setUri(URI uri)`
`RequestBuilder` `setVersion(ProtocolVersion version)`
`String` `toString()`
`static RequestBuilder` `trace()`
`static RequestBuilder` `trace(String uri)`
`static RequestBuilder` `trace(URI uri)`

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

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

### Method Detail

#### create

    public static RequestBuilder create(String method)

#### get

    public static RequestBuilder get()

#### get

    public static RequestBuilder get(URI uri)

Since:
  4.4

#### get

    public static RequestBuilder get(String uri)

Since:
  4.4

#### head

    public static RequestBuilder head()

#### head

    public static RequestBuilder head(URI uri)

Since:
  4.4

#### head

    public static RequestBuilder head(String uri)

Since:
  4.4

#### patch

    public static RequestBuilder patch()

Since:
  4.4

#### patch

    public static RequestBuilder patch(URI uri)

Since:
  4.4

#### patch

    public static RequestBuilder patch(String uri)

Since:
  4.4

#### post

    public static RequestBuilder post()

#### post

    public static RequestBuilder post(URI uri)

Since:
  4.4

#### post

    public static RequestBuilder post(String uri)

Since:
  4.4

#### put

    public static RequestBuilder put()

#### put

    public static RequestBuilder put(URI uri)

Since:
  4.4

#### put

    public static RequestBuilder put(String uri)

Since:
  4.4

#### delete

    public static RequestBuilder delete()

#### delete

    public static RequestBuilder delete(URI uri)

Since:
  4.4

#### delete

    public static RequestBuilder delete(String uri)

Since:
  4.4

#### trace

    public static RequestBuilder trace()

#### trace

    public static RequestBuilder trace(URI uri)

Since:
  4.4

#### trace

    public static RequestBuilder trace(String uri)

Since:
  4.4

#### options

    public static RequestBuilder options()

#### options

    public static RequestBuilder options(URI uri)

Since:
  4.4

#### options

    public static RequestBuilder options(String uri)

Since:
  4.4

#### copy

    public static RequestBuilder copy(ClassicHttpRequest request)

#### setCharset

    public RequestBuilder setCharset(Charset charset)

Since:
  4.4

#### getCharset

    public Charset getCharset()

Since:
  4.4

#### getMethod

    public String getMethod()

#### getVersion

    public ProtocolVersion getVersion()

#### setVersion

    public RequestBuilder setVersion(ProtocolVersion version)

#### getUri

    public URI getUri()

#### setUri

    public RequestBuilder setUri(URI uri)

#### setUri

    public RequestBuilder setUri(String uri)

#### getFirstHeader

    public Header getFirstHeader(String name)

#### getLastHeader

    public Header getLastHeader(String name)

#### getHeaders

    public Header[] getHeaders(String name)

#### addHeader

    public RequestBuilder addHeader(Header header)

#### addHeader

    public RequestBuilder addHeader(String name,
                           String value)

#### removeHeader

    public RequestBuilder removeHeader(Header header)

#### removeHeaders

    public RequestBuilder removeHeaders(String name)

#### setHeader

    public RequestBuilder setHeader(Header header)

#### setHeader

    public RequestBuilder setHeader(String name,
                           String value)

#### getEntity

    public HttpEntity getEntity()

#### setEntity

    public RequestBuilder setEntity(HttpEntity entity)

#### getParameters

    public List<NameValuePair> getParameters()

#### addParameter

    public RequestBuilder addParameter(NameValuePair nvp)

#### addParameter

    public RequestBuilder addParameter(String name,
                              String value)

#### addParameters

    public RequestBuilder addParameters(NameValuePair... nvps)

#### getConfig

    public RequestConfig getConfig()

#### setConfig

    public RequestBuilder setConfig(RequestConfig config)

#### build

    public ClassicHttpRequest build()

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`