Class Request
- java.lang.Object
-
- org.apache.hc.client5.http.fluent.Request
-
public class Request extends java.lang.Object
HTTP request used by the fluent facade.- Since:
- 4.2
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.hc.core5.util.Timeout
connectTimeout
static java.lang.String
DATE_FORMAT
Deprecated.This attribute is no longer supported as a part of the public API.static java.util.Locale
DATE_LOCALE
Deprecated.This attribute is no longer supported as a part of the public API.private org.apache.hc.core5.http.HttpHost
proxy
private org.apache.hc.core5.http.ClassicHttpRequest
request
private org.apache.hc.core5.util.Timeout
responseTimeout
static java.util.TimeZone
TIME_ZONE
Deprecated.This attribute is no longer supported as a part of the public API.private java.lang.Boolean
useExpectContinue
-
Constructor Summary
Constructors Constructor Description Request(org.apache.hc.core5.http.ClassicHttpRequest request)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Request
addHeader(java.lang.String name, java.lang.String value)
Request
addHeader(org.apache.hc.core5.http.Header header)
Request
body(org.apache.hc.core5.http.HttpEntity entity)
Request
bodyByteArray(byte[] b)
Request
bodyByteArray(byte[] b, int off, int len)
Request
bodyByteArray(byte[] b, int off, int len, org.apache.hc.core5.http.ContentType contentType)
Request
bodyByteArray(byte[] b, org.apache.hc.core5.http.ContentType contentType)
Request
bodyFile(java.io.File file, org.apache.hc.core5.http.ContentType contentType)
Request
bodyForm(java.lang.Iterable<? extends org.apache.hc.core5.http.NameValuePair> formParams)
Request
bodyForm(java.lang.Iterable<? extends org.apache.hc.core5.http.NameValuePair> formParams, java.nio.charset.Charset charset)
Request
bodyForm(org.apache.hc.core5.http.NameValuePair... formParams)
Request
bodyStream(java.io.InputStream inStream)
Request
bodyStream(java.io.InputStream inStream, org.apache.hc.core5.http.ContentType contentType)
Request
bodyString(java.lang.String s, org.apache.hc.core5.http.ContentType contentType)
Request
connectTimeout(org.apache.hc.core5.util.Timeout timeout)
static Request
create(java.lang.String methodName, java.lang.String uri)
static Request
create(java.lang.String methodName, java.net.URI uri)
static Request
create(org.apache.hc.core5.http.Method method, java.net.URI uri)
static Request
delete(java.lang.String uri)
static Request
delete(java.net.URI uri)
Response
execute()
Response
execute(CloseableHttpClient client)
static Request
get(java.lang.String uri)
static Request
get(java.net.URI uri)
(package private) org.apache.hc.core5.http.ClassicHttpRequest
getRequest()
static Request
head(java.lang.String uri)
static Request
head(java.net.URI uri)
(package private) org.apache.hc.core5.http.ClassicHttpResponse
internalExecute(CloseableHttpClient client, HttpClientContext localContext)
static Request
options(java.lang.String uri)
static Request
options(java.net.URI uri)
static Request
patch(java.lang.String uri)
static Request
patch(java.net.URI uri)
static Request
post(java.lang.String uri)
static Request
post(java.net.URI uri)
static Request
put(java.lang.String uri)
static Request
put(java.net.URI uri)
Request
removeHeader(org.apache.hc.core5.http.Header header)
Request
removeHeaders(java.lang.String name)
Request
responseTimeout(org.apache.hc.core5.util.Timeout timeout)
Request
setCacheControl(java.lang.String cacheControl)
Request
setDate(java.time.Instant instant)
Request
setDate(java.util.Date date)
Deprecated.UsesetDate(Instant)
Request
setHeader(java.lang.String name, java.lang.String value)
Request
setHeader(org.apache.hc.core5.http.Header header)
Request
setHeaders(org.apache.hc.core5.http.Header... headers)
Request
setIfModifiedSince(java.time.Instant instant)
Request
setIfModifiedSince(java.util.Date date)
Deprecated.Request
setIfUnmodifiedSince(java.time.Instant instant)
Request
setIfUnmodifiedSince(java.util.Date date)
Deprecated.java.lang.String
toString()
static Request
trace(java.lang.String uri)
static Request
trace(java.net.URI uri)
Request
useExpectContinue()
Request
userAgent(java.lang.String agent)
Request
version(org.apache.hc.core5.http.HttpVersion version)
Request
viaProxy(java.lang.String proxy)
Request
viaProxy(org.apache.hc.core5.http.HttpHost proxy)
-
-
-
Field Detail
-
DATE_FORMAT
@Deprecated public static final java.lang.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 java.util.Locale DATE_LOCALE
Deprecated.This attribute is no longer supported as a part of the public API.
-
TIME_ZONE
@Deprecated public static final java.util.TimeZone TIME_ZONE
Deprecated.This attribute is no longer supported as a part of the public API.
-
request
private final org.apache.hc.core5.http.ClassicHttpRequest request
-
useExpectContinue
private java.lang.Boolean useExpectContinue
-
connectTimeout
private org.apache.hc.core5.util.Timeout connectTimeout
-
responseTimeout
private org.apache.hc.core5.util.Timeout responseTimeout
-
proxy
private org.apache.hc.core5.http.HttpHost proxy
-
-
Method Detail
-
create
public static Request create(org.apache.hc.core5.http.Method method, java.net.URI uri)
-
create
public static Request create(java.lang.String methodName, java.lang.String uri)
-
create
public static Request create(java.lang.String methodName, java.net.URI uri)
-
get
public static Request get(java.net.URI uri)
-
get
public static Request get(java.lang.String uri)
-
head
public static Request head(java.net.URI uri)
-
head
public static Request head(java.lang.String uri)
-
post
public static Request post(java.net.URI uri)
-
post
public static Request post(java.lang.String uri)
-
patch
public static Request patch(java.net.URI uri)
-
patch
public static Request patch(java.lang.String uri)
-
put
public static Request put(java.net.URI uri)
-
put
public static Request put(java.lang.String uri)
-
trace
public static Request trace(java.net.URI uri)
-
trace
public static Request trace(java.lang.String uri)
-
delete
public static Request delete(java.net.URI uri)
-
delete
public static Request delete(java.lang.String uri)
-
options
public static Request options(java.net.URI uri)
-
options
public static Request options(java.lang.String uri)
-
internalExecute
org.apache.hc.core5.http.ClassicHttpResponse internalExecute(CloseableHttpClient client, HttpClientContext localContext) throws java.io.IOException
- Throws:
java.io.IOException
-
execute
public Response execute() throws java.io.IOException
- Throws:
java.io.IOException
-
execute
public Response execute(CloseableHttpClient client) throws java.io.IOException
- Throws:
java.io.IOException
-
addHeader
public Request addHeader(org.apache.hc.core5.http.Header header)
-
setHeader
public Request setHeader(org.apache.hc.core5.http.Header header)
- Since:
- 4.3
-
addHeader
public Request addHeader(java.lang.String name, java.lang.String value)
-
setHeader
public Request setHeader(java.lang.String name, java.lang.String value)
- Since:
- 4.3
-
removeHeader
public Request removeHeader(org.apache.hc.core5.http.Header header)
-
removeHeaders
public Request removeHeaders(java.lang.String name)
-
setHeaders
public Request setHeaders(org.apache.hc.core5.http.Header... headers)
-
setCacheControl
public Request setCacheControl(java.lang.String cacheControl)
-
getRequest
org.apache.hc.core5.http.ClassicHttpRequest getRequest()
-
setDate
@Deprecated public Request setDate(java.util.Date date)
Deprecated.UsesetDate(Instant)
-
setIfModifiedSince
@Deprecated public Request setIfModifiedSince(java.util.Date date)
Deprecated.
-
setIfUnmodifiedSince
@Deprecated public Request setIfUnmodifiedSince(java.util.Date date)
Deprecated.
-
setDate
public Request setDate(java.time.Instant instant)
-
setIfModifiedSince
public Request setIfModifiedSince(java.time.Instant instant)
-
setIfUnmodifiedSince
public Request setIfUnmodifiedSince(java.time.Instant instant)
-
version
public Request version(org.apache.hc.core5.http.HttpVersion version)
-
useExpectContinue
public Request useExpectContinue()
-
userAgent
public Request userAgent(java.lang.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(java.lang.String proxy)
- Since:
- 4.4
-
body
public Request body(org.apache.hc.core5.http.HttpEntity entity)
-
bodyForm
public Request bodyForm(java.lang.Iterable<? extends org.apache.hc.core5.http.NameValuePair> formParams, java.nio.charset.Charset charset)
-
bodyForm
public Request bodyForm(java.lang.Iterable<? extends org.apache.hc.core5.http.NameValuePair> formParams)
-
bodyForm
public Request bodyForm(org.apache.hc.core5.http.NameValuePair... formParams)
-
bodyString
public Request bodyString(java.lang.String s, org.apache.hc.core5.http.ContentType contentType)
-
bodyFile
public Request bodyFile(java.io.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)
- 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)
- Since:
- 4.4
-
bodyStream
public Request bodyStream(java.io.InputStream inStream)
-
bodyStream
public Request bodyStream(java.io.InputStream inStream, org.apache.hc.core5.http.ContentType contentType)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-