Package org.jsoup.helper
Class HttpConnection.Request
java.lang.Object
org.jsoup.helper.HttpConnection.Request
- All Implemented Interfaces:
Connection.Base<Connection.Request>,Connection.Request
- Enclosing class:
- HttpConnection
public static class HttpConnection.Request extends Object implements Connection.Request
-
Method Summary
Modifier and Type Method Description Collection<Connection.KeyVal>data()Get all of the request's data parametersHttpConnection.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.HttpConnection.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.HttpConnection.Requestproxy(String host, int port)Set the HTTP proxy to use for this request.HttpConnection.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.HttpConnection.Requesttimeout(int millis)Update the request timeout.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
Description copied from interface:Connection.RequestGet the proxy used for this request.- Specified by:
proxyin interfaceConnection.Request- Returns:
- the proxy;
nullif not enabled.
-
proxy
Description copied from interface:Connection.RequestUpdate the proxy for this request.- Specified by:
proxyin interfaceConnection.Request- Parameters:
proxy- the proxy ot use;nullto disable.- Returns:
- this Request, for chaining
-
proxy
Description copied from interface:Connection.RequestSet the HTTP proxy to use for this request.- Specified by:
proxyin interfaceConnection.Request- Parameters:
host- the proxy hostnameport- the proxy port- Returns:
- this Connection, for chaining
-
timeout
public int timeout()Description copied from interface:Connection.RequestGet the request timeout, in milliseconds.- Specified by:
timeoutin interfaceConnection.Request- Returns:
- the timeout in milliseconds.
-
timeout
Description copied from interface:Connection.RequestUpdate the request timeout.- Specified by:
timeoutin interfaceConnection.Request- Parameters:
millis- timeout, in milliseconds- Returns:
- this Request, for chaining
-
maxBodySize
public int maxBodySize()Description copied from interface:Connection.RequestGet the maximum body size, in bytes.- Specified by:
maxBodySizein interfaceConnection.Request- Returns:
- the maximum body size, in bytes.
-
maxBodySize
Description copied from interface:Connection.RequestUpdate the maximum body size, in bytes.- Specified by:
maxBodySizein interfaceConnection.Request- Parameters:
bytes- maximum body size, in bytes.- Returns:
- this Request, for chaining
-
followRedirects
public boolean followRedirects()Description copied from interface:Connection.RequestGet the current followRedirects configuration.- Specified by:
followRedirectsin interfaceConnection.Request- Returns:
- true if followRedirects is enabled.
-
followRedirects
Description copied from interface:Connection.RequestConfigures the request to (not) follow server redirects. By default this is true.- Specified by:
followRedirectsin interfaceConnection.Request- Parameters:
followRedirects- true if server redirects should be followed.- Returns:
- this Request, for chaining
-
ignoreHttpErrors
public boolean ignoreHttpErrors()Description copied from interface:Connection.RequestGet the current ignoreHttpErrors configuration.- Specified by:
ignoreHttpErrorsin interfaceConnection.Request- Returns:
- true if errors will be ignored; false (default) if HTTP errors will cause an IOException to be thrown.
-
sslSocketFactory
Description copied from interface:Connection.RequestGet the current custom SSL socket factory, if any.- Specified by:
sslSocketFactoryin interfaceConnection.Request- Returns:
- custom SSL socket factory if set, null otherwise
-
sslSocketFactory
Description copied from interface:Connection.RequestSet a custom SSL socket factory.- Specified by:
sslSocketFactoryin interfaceConnection.Request- Parameters:
sslSocketFactory- SSL socket factory
-
ignoreHttpErrors
Description copied from interface:Connection.RequestConfigures the request to ignore HTTP errors in the response.- Specified by:
ignoreHttpErrorsin interfaceConnection.Request- Parameters:
ignoreHttpErrors- set to true to ignore HTTP errors.- Returns:
- this Request, for chaining
-
ignoreContentType
public boolean ignoreContentType()Description copied from interface:Connection.RequestGet the current ignoreContentType configuration.- Specified by:
ignoreContentTypein interfaceConnection.Request- Returns:
- true if invalid content-types will be ignored; false (default) if they will cause an IOException to be thrown.
-
ignoreContentType
Description copied from interface:Connection.RequestConfigures the request to ignore the Content-Type of the response.- Specified by:
ignoreContentTypein interfaceConnection.Request- Parameters:
ignoreContentType- set to true to ignore the content type.- Returns:
- this Request, for chaining
-
data
Description copied from interface:Connection.RequestAdd a data parameter to the request- Specified by:
datain interfaceConnection.Request- Parameters:
keyval- data to add.- Returns:
- this Request, for chaining
-
data
Description copied from interface:Connection.RequestGet all of the request's data parameters- Specified by:
datain interfaceConnection.Request- Returns:
- collection of keyvals
-
requestBody
Description copied from interface:Connection.RequestSet 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();- Specified by:
requestBodyin interfaceConnection.Request- Parameters:
body- to use as the request body. Set to null to clear a previously set body.- Returns:
- this Request, for chaining
-
requestBody
Description copied from interface:Connection.RequestGet the current request body.- Specified by:
requestBodyin interfaceConnection.Request- Returns:
- null if not set.
-
parser
Description copied from interface:Connection.RequestSpecify the parser to use when parsing the document.- Specified by:
parserin interfaceConnection.Request- Parameters:
parser- parser to use.- Returns:
- this Request, for chaining
-
parser
Description copied from interface:Connection.RequestGet the current parser to use when parsing the document.- Specified by:
parserin interfaceConnection.Request- Returns:
- current Parser
-
postDataCharset
Description copied from interface:Connection.RequestSets the post data character set for x-www-form-urlencoded post data- Specified by:
postDataCharsetin interfaceConnection.Request- Parameters:
charset- character set to encode post data- Returns:
- this Request, for chaining
-
postDataCharset
Description copied from interface:Connection.RequestGets the post data character set for x-www-form-urlencoded post data- Specified by:
postDataCharsetin interfaceConnection.Request- Returns:
- character set to encode post data
-