Package org.apache.http.client.methods
Class RequestBuilder
- java.lang.Object
-
- org.apache.http.client.methods.RequestBuilder
-
public class RequestBuilder extends java.lang.Object
Builder forHttpUriRequest
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.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 encodedentity
.- Since:
- 4.3
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestBuilder
addHeader(java.lang.String name, java.lang.String value)
RequestBuilder
addHeader(Header header)
RequestBuilder
addParameter(java.lang.String name, java.lang.String value)
RequestBuilder
addParameter(NameValuePair nvp)
RequestBuilder
addParameters(NameValuePair... nvps)
HttpUriRequest
build()
static RequestBuilder
copy(HttpRequest request)
static RequestBuilder
create(java.lang.String method)
static RequestBuilder
delete()
static RequestBuilder
delete(java.lang.String uri)
static RequestBuilder
delete(java.net.URI uri)
static RequestBuilder
get()
static RequestBuilder
get(java.lang.String uri)
static RequestBuilder
get(java.net.URI uri)
java.nio.charset.Charset
getCharset()
RequestConfig
getConfig()
HttpEntity
getEntity()
Header
getFirstHeader(java.lang.String name)
Header[]
getHeaders(java.lang.String name)
Header
getLastHeader(java.lang.String name)
java.lang.String
getMethod()
java.util.List<NameValuePair>
getParameters()
java.net.URI
getUri()
ProtocolVersion
getVersion()
static RequestBuilder
head()
static RequestBuilder
head(java.lang.String uri)
static RequestBuilder
head(java.net.URI uri)
static RequestBuilder
options()
static RequestBuilder
options(java.lang.String uri)
static RequestBuilder
options(java.net.URI uri)
static RequestBuilder
patch()
static RequestBuilder
patch(java.lang.String uri)
static RequestBuilder
patch(java.net.URI uri)
static RequestBuilder
post()
static RequestBuilder
post(java.lang.String uri)
static RequestBuilder
post(java.net.URI uri)
static RequestBuilder
put()
static RequestBuilder
put(java.lang.String uri)
static RequestBuilder
put(java.net.URI uri)
RequestBuilder
removeHeader(Header header)
RequestBuilder
removeHeaders(java.lang.String name)
RequestBuilder
setCharset(java.nio.charset.Charset charset)
RequestBuilder
setConfig(RequestConfig config)
RequestBuilder
setEntity(HttpEntity entity)
RequestBuilder
setHeader(java.lang.String name, java.lang.String value)
RequestBuilder
setHeader(Header header)
RequestBuilder
setUri(java.lang.String uri)
RequestBuilder
setUri(java.net.URI uri)
RequestBuilder
setVersion(ProtocolVersion version)
java.lang.String
toString()
static RequestBuilder
trace()
static RequestBuilder
trace(java.lang.String uri)
static RequestBuilder
trace(java.net.URI uri)
-
-
-
Method Detail
-
create
public static RequestBuilder create(java.lang.String method)
-
get
public static RequestBuilder get()
-
get
public static RequestBuilder get(java.net.URI uri)
- Since:
- 4.4
-
get
public static RequestBuilder get(java.lang.String uri)
- Since:
- 4.4
-
head
public static RequestBuilder head()
-
head
public static RequestBuilder head(java.net.URI uri)
- Since:
- 4.4
-
head
public static RequestBuilder head(java.lang.String uri)
- Since:
- 4.4
-
patch
public static RequestBuilder patch()
- Since:
- 4.4
-
patch
public static RequestBuilder patch(java.net.URI uri)
- Since:
- 4.4
-
patch
public static RequestBuilder patch(java.lang.String uri)
- Since:
- 4.4
-
post
public static RequestBuilder post()
-
post
public static RequestBuilder post(java.net.URI uri)
- Since:
- 4.4
-
post
public static RequestBuilder post(java.lang.String uri)
- Since:
- 4.4
-
put
public static RequestBuilder put()
-
put
public static RequestBuilder put(java.net.URI uri)
- Since:
- 4.4
-
put
public static RequestBuilder put(java.lang.String uri)
- Since:
- 4.4
-
delete
public static RequestBuilder delete()
-
delete
public static RequestBuilder delete(java.net.URI uri)
- Since:
- 4.4
-
delete
public static RequestBuilder delete(java.lang.String uri)
- Since:
- 4.4
-
trace
public static RequestBuilder trace()
-
trace
public static RequestBuilder trace(java.net.URI uri)
- Since:
- 4.4
-
trace
public static RequestBuilder trace(java.lang.String uri)
- Since:
- 4.4
-
options
public static RequestBuilder options()
-
options
public static RequestBuilder options(java.net.URI uri)
- Since:
- 4.4
-
options
public static RequestBuilder options(java.lang.String uri)
- Since:
- 4.4
-
copy
public static RequestBuilder copy(HttpRequest request)
-
setCharset
public RequestBuilder setCharset(java.nio.charset.Charset charset)
- Since:
- 4.4
-
getCharset
public java.nio.charset.Charset getCharset()
- Since:
- 4.4
-
getMethod
public java.lang.String getMethod()
-
getVersion
public ProtocolVersion getVersion()
-
setVersion
public RequestBuilder setVersion(ProtocolVersion version)
-
getUri
public java.net.URI getUri()
-
setUri
public RequestBuilder setUri(java.net.URI uri)
-
setUri
public RequestBuilder setUri(java.lang.String uri)
-
getFirstHeader
public Header getFirstHeader(java.lang.String name)
-
getLastHeader
public Header getLastHeader(java.lang.String name)
-
getHeaders
public Header[] getHeaders(java.lang.String name)
-
addHeader
public RequestBuilder addHeader(Header header)
-
addHeader
public RequestBuilder addHeader(java.lang.String name, java.lang.String value)
-
removeHeader
public RequestBuilder removeHeader(Header header)
-
removeHeaders
public RequestBuilder removeHeaders(java.lang.String name)
-
setHeader
public RequestBuilder setHeader(Header header)
-
setHeader
public RequestBuilder setHeader(java.lang.String name, java.lang.String value)
-
getEntity
public HttpEntity getEntity()
-
setEntity
public RequestBuilder setEntity(HttpEntity entity)
-
getParameters
public java.util.List<NameValuePair> getParameters()
-
addParameter
public RequestBuilder addParameter(NameValuePair nvp)
-
addParameter
public RequestBuilder addParameter(java.lang.String name, java.lang.String value)
-
addParameters
public RequestBuilder addParameters(NameValuePair... nvps)
-
getConfig
public RequestConfig getConfig()
-
setConfig
public RequestBuilder setConfig(RequestConfig config)
-
build
public HttpUriRequest build()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-