public static interface Connection.Request extends Connection.Base<Connection.Request>
Modifier and Type | Method and Description |
---|---|
java.util.Collection<Connection.KeyVal> |
data()
Get all of the request's data parameters
|
Connection.Request |
data(Connection.KeyVal keyval)
Add a data parameter to the request
|
boolean |
followRedirects()
Get the current followRedirects configuration.
|
Connection.Request |
followRedirects(boolean followRedirects)
Configures the request to (not) follow server redirects.
|
boolean |
ignoreContentType()
Get the current ignoreContentType configuration.
|
Connection.Request |
ignoreContentType(boolean ignoreContentType)
Configures the request to ignore the Content-Type of the response.
|
boolean |
ignoreHttpErrors()
Get the current ignoreHttpErrors configuration.
|
Connection.Request |
ignoreHttpErrors(boolean ignoreHttpErrors)
Configures the request to ignore HTTP errors in the response.
|
int |
maxBodySize()
Get the maximum body size, in bytes.
|
Connection.Request |
maxBodySize(int bytes)
Update the maximum body size, in bytes.
|
Parser |
parser()
Get the current parser to use when parsing the document.
|
Connection.Request |
parser(Parser parser)
Specify the parser to use when parsing the document.
|
java.lang.String |
postDataCharset()
Gets the post data character set for x-www-form-urlencoded post data
|
Connection.Request |
postDataCharset(java.lang.String charset)
Sets the post data character set for x-www-form-urlencoded post data
|
java.net.Proxy |
proxy()
Get the proxy used for this request.
|
Connection.Request |
proxy(java.net.Proxy proxy)
Update the proxy for this request.
|
Connection.Request |
proxy(java.lang.String host,
int port)
Set the HTTP proxy to use for this request.
|
java.lang.String |
requestBody()
Get the current request body.
|
Connection.Request |
requestBody(java.lang.String body)
Set a POST (or PUT) request body.
|
javax.net.ssl.SSLSocketFactory |
sslSocketFactory()
Get the current custom SSL socket factory, if any.
|
void |
sslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
Set a custom SSL socket factory.
|
int |
timeout()
Get the request timeout, in milliseconds.
|
Connection.Request |
timeout(int millis)
Update the request timeout.
|
boolean |
validateTLSCertificates()
Deprecated.
|
void |
validateTLSCertificates(boolean value)
Deprecated.
as distributions (specifically Google Play) are starting to show warnings if these checks are
disabled. This method will be removed in the next release.
|
addHeader, cookie, cookie, cookies, hasCookie, hasHeader, hasHeaderWithValue, header, header, headers, headers, method, method, multiHeaders, removeCookie, removeHeader, url, url
java.net.Proxy proxy()
null
if not enabled.Connection.Request proxy(java.net.Proxy proxy)
proxy
- the proxy ot use; null
to disable.Connection.Request proxy(java.lang.String host, int port)
host
- the proxy hostnameport
- the proxy portint timeout()
Connection.Request timeout(int millis)
millis
- timeout, in millisecondsint maxBodySize()
Connection.Request maxBodySize(int bytes)
bytes
- maximum body size, in bytes.boolean followRedirects()
Connection.Request followRedirects(boolean followRedirects)
followRedirects
- true if server redirects should be followed.boolean ignoreHttpErrors()
Connection.Request ignoreHttpErrors(boolean ignoreHttpErrors)
ignoreHttpErrors
- set to true to ignore HTTP errors.boolean ignoreContentType()
Connection.Request ignoreContentType(boolean ignoreContentType)
ignoreContentType
- set to true to ignore the content type.boolean validateTLSCertificates()
void validateTLSCertificates(boolean value)
value
- set false to ignore TLS (SSL) certificatessslSocketFactory(javax.net.ssl.SSLSocketFactory)
javax.net.ssl.SSLSocketFactory sslSocketFactory()
void sslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
sslSocketFactory
- SSL socket factoryConnection.Request data(Connection.KeyVal keyval)
keyval
- data to add.java.util.Collection<Connection.KeyVal> data()
Connection.Request requestBody(java.lang.String body)
Jsoup.connect(url)
.requestBody(json)
.header("Content-Type", "application/json")
.post();
If any data key/vals are supplied, they will be sent as URL query params.java.lang.String requestBody()
Connection.Request parser(Parser parser)
parser
- parser to use.Parser parser()
Connection.Request postDataCharset(java.lang.String charset)
charset
- character set to encode post datajava.lang.String postDataCharset()