Package org.jsoup
Interface Connection.Request
- All Superinterfaces:
Connection.Base<Connection.Request>
- All Known Implementing Classes:
HttpConnection.Request
- Enclosing interface:
- Connection
public static interface Connection.Request extends Connection.Base<Connection.Request>
Represents a HTTP request.
-
Method Summary
Modifier and Type Method Description Collection<Connection.KeyVal>data()Get all of the request's data parametersConnection.Requestdata(Connection.KeyVal keyval)Add a data parameter to the requestbooleanfollowRedirects()Get the current followRedirects configuration.Connection.RequestfollowRedirects(boolean followRedirects)Configures the request to (not) follow server redirects.booleanignoreContentType()Get the current ignoreContentType configuration.Connection.RequestignoreContentType(boolean ignoreContentType)Configures the request to ignore the Content-Type of the response.booleanignoreHttpErrors()Get the current ignoreHttpErrors configuration.Connection.RequestignoreHttpErrors(boolean ignoreHttpErrors)Configures the request to ignore HTTP errors in the response.intmaxBodySize()Get the maximum body size, in bytes.Connection.RequestmaxBodySize(int bytes)Update the maximum body size, in bytes.Parserparser()Get the current parser to use when parsing the document.Connection.Requestparser(Parser parser)Specify the parser to use when parsing the document.StringpostDataCharset()Gets the post data character set for x-www-form-urlencoded post dataConnection.RequestpostDataCharset(String charset)Sets the post data character set for x-www-form-urlencoded post dataProxyproxy()Get the proxy used for this request.Connection.Requestproxy(String host, int port)Set the HTTP proxy to use for this request.Connection.Requestproxy(Proxy proxy)Update the proxy for this request.StringrequestBody()Get the current request body.Connection.RequestrequestBody(String body)Set a POST (or PUT) request body.SSLSocketFactorysslSocketFactory()Get the current custom SSL socket factory, if any.voidsslSocketFactory(SSLSocketFactory sslSocketFactory)Set a custom SSL socket factory.inttimeout()Get the request timeout, in milliseconds.Connection.Requesttimeout(int millis)Update the request timeout.Methods inherited from interface org.jsoup.Connection.Base
addHeader, cookie, cookie, cookies, hasCookie, hasHeader, hasHeaderWithValue, header, header, headers, headers, method, method, multiHeaders, removeCookie, removeHeader, url, url
-
Method Details
-
proxy
Get the proxy used for this request.- Returns:
- the proxy;
nullif not enabled.
-
proxy
Update the proxy for this request.- Parameters:
proxy- the proxy ot use;nullto disable.- Returns:
- this Request, for chaining
-
proxy
Set the HTTP proxy to use for this request.- Parameters:
host- the proxy hostnameport- the proxy port- Returns:
- this Connection, for chaining
-
timeout
int timeout()Get the request timeout, in milliseconds.- Returns:
- the timeout in milliseconds.
-
timeout
Update the request timeout.- Parameters:
millis- timeout, in milliseconds- Returns:
- this Request, for chaining
-
maxBodySize
int maxBodySize()Get the maximum body size, in bytes.- Returns:
- the maximum body size, in bytes.
-
maxBodySize
Update the maximum body size, in bytes.- Parameters:
bytes- maximum body size, in bytes.- Returns:
- this Request, for chaining
-
followRedirects
boolean followRedirects()Get the current followRedirects configuration.- Returns:
- true if followRedirects is enabled.
-
followRedirects
Configures the request to (not) follow server redirects. By default this is true.- Parameters:
followRedirects- true if server redirects should be followed.- Returns:
- this Request, for chaining
-
ignoreHttpErrors
boolean ignoreHttpErrors()Get the current ignoreHttpErrors configuration.- Returns:
- true if errors will be ignored; false (default) if HTTP errors will cause an IOException to be thrown.
-
ignoreHttpErrors
Configures the request to ignore HTTP errors in the response.- Parameters:
ignoreHttpErrors- set to true to ignore HTTP errors.- Returns:
- this Request, for chaining
-
ignoreContentType
boolean ignoreContentType()Get the current ignoreContentType configuration.- Returns:
- true if invalid content-types will be ignored; false (default) if they will cause an IOException to be thrown.
-
ignoreContentType
Configures the request to ignore the Content-Type of the response.- Parameters:
ignoreContentType- set to true to ignore the content type.- Returns:
- this Request, for chaining
-
sslSocketFactory
Get the current custom SSL socket factory, if any.- Returns:
- custom SSL socket factory if set, null otherwise
-
sslSocketFactory
Set a custom SSL socket factory.- Parameters:
sslSocketFactory- SSL socket factory
-
data
Add a data parameter to the request- Parameters:
keyval- data to add.- Returns:
- this Request, for chaining
-
data
Collection<Connection.KeyVal> data()Get all of the request's data parameters- Returns:
- collection of keyvals
-
requestBody
Set a POST (or PUT) request body. Useful when a server expects a plain request body, not a set for URL encoded form key/value pairs. E.g.:If any data key/vals are supplied, they will be sent as URL query params.Jsoup.connect(url) .requestBody(json) .header("Content-Type", "application/json") .post();- Parameters:
body- to use as the request body. Set to null to clear a previously set body.- Returns:
- this Request, for chaining
-
requestBody
Get the current request body.- Returns:
- null if not set.
-
parser
Specify the parser to use when parsing the document.- Parameters:
parser- parser to use.- Returns:
- this Request, for chaining
-
parser
Parser parser()Get the current parser to use when parsing the document.- Returns:
- current Parser
-
postDataCharset
Sets the post data character set for x-www-form-urlencoded post data- Parameters:
charset- character set to encode post data- Returns:
- this Request, for chaining
-
postDataCharset
String postDataCharset()Gets the post data character set for x-www-form-urlencoded post data- Returns:
- character set to encode post data
-