public static class HttpConnection.Request extends HttpConnection.Base<Connection.Request> implements Connection.Request
Modifier and Type | Field and Description |
---|---|
private String |
body |
private Collection<Connection.KeyVal> |
data |
private boolean |
followRedirects |
private boolean |
ignoreContentType |
private boolean |
ignoreHttpErrors |
private int |
maxBodySizeBytes |
private Parser |
parser |
private boolean |
parserDefined |
private String |
postDataCharset |
private Proxy |
proxy |
private int |
timeoutMilliseconds |
private boolean |
validateTSLCertificates |
cookies, headers, method, url
Constructor and Description |
---|
Request() |
Modifier and Type | Method and Description |
---|---|
Collection<Connection.KeyVal> |
data()
Get all of the request's data parameters
|
HttpConnection.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.
|
HttpConnection.Request |
parser(Parser parser)
Specify the parser to use when parsing the document.
|
String |
postDataCharset()
Gets the post data character set for x-www-form-urlencoded post data
|
Connection.Request |
postDataCharset(String charset)
Sets the post data character set for x-www-form-urlencoded post data
|
Proxy |
proxy()
Get the proxy used for this request.
|
HttpConnection.Request |
proxy(Proxy proxy)
Update the proxy for this request.
|
HttpConnection.Request |
proxy(String host,
int port)
Set the HTTP proxy to use for this request.
|
String |
requestBody()
Get the current request body.
|
Connection.Request |
requestBody(String body)
Set a POST (or PUT) request body.
|
int |
timeout()
Get the request timeout, in milliseconds.
|
HttpConnection.Request |
timeout(int millis)
Update the request timeout.
|
boolean |
validateTLSCertificates()
Get the current state of TLS (SSL) certificate validation.
|
void |
validateTLSCertificates(boolean value)
Set TLS certificate validation.
|
addHeader, cookie, cookie, cookies, hasCookie, hasHeader, hasHeaderWithValue, header, header, headers, headers, method, method, multiHeaders, removeCookie, removeHeader, url, url
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addHeader, cookie, cookie, cookies, hasCookie, hasHeader, hasHeaderWithValue, header, header, headers, headers, method, method, multiHeaders, removeCookie, removeHeader, url, url
private int timeoutMilliseconds
private int maxBodySizeBytes
private boolean followRedirects
private Collection<Connection.KeyVal> data
private boolean ignoreHttpErrors
private boolean ignoreContentType
private boolean parserDefined
private boolean validateTSLCertificates
private String postDataCharset
Request()
public Proxy proxy()
Connection.Request
proxy
in interface Connection.Request
null
if not enabled.public HttpConnection.Request proxy(Proxy proxy)
Connection.Request
proxy
in interface Connection.Request
proxy
- the proxy ot use; null
to disable.public HttpConnection.Request proxy(String host, int port)
Connection.Request
proxy
in interface Connection.Request
host
- the proxy hostnameport
- the proxy portpublic int timeout()
Connection.Request
timeout
in interface Connection.Request
public HttpConnection.Request timeout(int millis)
Connection.Request
timeout
in interface Connection.Request
millis
- timeout, in millisecondspublic int maxBodySize()
Connection.Request
maxBodySize
in interface Connection.Request
public Connection.Request maxBodySize(int bytes)
Connection.Request
maxBodySize
in interface Connection.Request
bytes
- maximum body size, in bytes.public boolean followRedirects()
Connection.Request
followRedirects
in interface Connection.Request
public Connection.Request followRedirects(boolean followRedirects)
Connection.Request
followRedirects
in interface Connection.Request
followRedirects
- true if server redirects should be followed.public boolean ignoreHttpErrors()
Connection.Request
ignoreHttpErrors
in interface Connection.Request
public boolean validateTLSCertificates()
Connection.Request
validateTLSCertificates
in interface Connection.Request
public void validateTLSCertificates(boolean value)
Connection.Request
validateTLSCertificates
in interface Connection.Request
value
- set false to ignore TLS (SSL) certificatespublic Connection.Request ignoreHttpErrors(boolean ignoreHttpErrors)
Connection.Request
ignoreHttpErrors
in interface Connection.Request
ignoreHttpErrors
- set to true to ignore HTTP errors.public boolean ignoreContentType()
Connection.Request
ignoreContentType
in interface Connection.Request
public Connection.Request ignoreContentType(boolean ignoreContentType)
Connection.Request
ignoreContentType
in interface Connection.Request
ignoreContentType
- set to true to ignore the content type.public HttpConnection.Request data(Connection.KeyVal keyval)
Connection.Request
data
in interface Connection.Request
keyval
- data to add.public Collection<Connection.KeyVal> data()
Connection.Request
data
in interface Connection.Request
public Connection.Request requestBody(String body)
Connection.Request
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.requestBody
in interface Connection.Request
public String requestBody()
Connection.Request
requestBody
in interface Connection.Request
public HttpConnection.Request parser(Parser parser)
Connection.Request
parser
in interface Connection.Request
parser
- parser to use.public Parser parser()
Connection.Request
parser
in interface Connection.Request
public Connection.Request postDataCharset(String charset)
Connection.Request
postDataCharset
in interface Connection.Request
charset
- character set to encode post datapublic String postDataCharset()
Connection.Request
postDataCharset
in interface Connection.Request
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses