public static class

HttpConnection.Request

extends Object
implements Connection.Base<T extends Base> Connection.Request
java.lang.Object
   ↳ org.jsoup.helper.HttpConnection.Request

Summary

Public Methods
T extends Base cookie(String name, String value)
Set a cookie in this request/response.
String cookie(String name)
Get a cookie value by name from this request/response.
Map<StringString> cookies()
Retrieve all of the request/response cookies as a map
HttpConnection.Request data(Connection.KeyVal keyval)
Add a data parameter to the request
Collection<Connection.KeyVal> data()
Get all of the request's data parameters
Connection.Request followRedirects(boolean followRedirects)
Configures the request to (not) follow server redirects.
boolean followRedirects()
Get the current followRedirects configuration.
boolean hasCookie(String name)
Check if a cookie is present
boolean hasHeader(String name)
Check if a header is present
T extends Base header(String name, String value)
Set a header.
String header(String name)
Get the value of a header.
Map<StringString> headers()
Retrieve all of the request/response headers as a map
Connection.Method method()
Get the request method
T extends Base method(Connection.Method method)
Set the request method
T extends Base removeCookie(String name)
Remove a cookie by name
T extends Base removeHeader(String name)
Remove a header by name
int timeout()
Get the request timeout, in milliseconds.
HttpConnection.Request timeout(int millis)
Update the request timeout.
URL url()
Get the URL
T extends Base url(URL url)
Set the URL
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.jsoup.Connection.Base
From interface org.jsoup.Connection.Request

Public Methods

public T extends Base cookie (String name, String value)

Set a cookie in this request/response.

Parameters
name name of cookie
value value of cookie
Returns
  • this, for chianing

public String cookie (String name)

Get a cookie value by name from this request/response.

Response objects have a simplified cookie model. Each cookie set in the response is added to the response object's cookie key=value map. The cookie's path, domain, and expiry date are ignored.

Parameters
name name of cookie to retrieve.
Returns
  • value of cookie, or null if not set

public Map<StringString> cookies ()

Retrieve all of the request/response cookies as a map

Returns
  • cookies

public HttpConnection.Request data (Connection.KeyVal keyval)

Add a data parameter to the request

Parameters
keyval data to add.
Returns
  • this Request, for chaining

public Collection<Connection.KeyVal> data ()

Get all of the request's data parameters

Returns
  • collection of keyvals

public Connection.Request followRedirects (boolean 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 Connection, for chaining

public boolean followRedirects ()

Get the current followRedirects configuration.

Returns
  • true if followRedirects is enabled.

public boolean hasCookie (String name)

Check if a cookie is present

Parameters
name name of cookie
Returns
  • if the cookie is present in this request/response

public boolean hasHeader (String name)

Check if a header is present

Parameters
name name of header (case insensitive)
Returns
  • if the header is present in this request/response

public T extends Base header (String name, String value)

Set a header. This method will overwrite any existing header with the same case insensitive name.

Parameters
name Name of header
value Value of header
Returns
  • this, for chaining

public String header (String name)

Get the value of a header. This is a simplified header model, where a header may only have one value.

Header names are case insensitive.

Parameters
name name of header (case insensitive)
Returns
  • value of header, or null if not set.

public Map<StringString> headers ()

Retrieve all of the request/response headers as a map

Returns
  • headers

public Connection.Method method ()

Get the request method

Returns
  • method

public T extends Base method (Connection.Method method)

Set the request method

Parameters
method new method
Returns
  • this, for chaining

public T extends Base removeCookie (String name)

Remove a cookie by name

Parameters
name name of cookie to remove
Returns
  • this, for chianing

public T extends Base removeHeader (String name)

Remove a header by name

Parameters
name name of header to remove (case insensitive)
Returns
  • this, for chianing

public int timeout ()

Get the request timeout, in milliseconds.

Returns
  • the timeout in milliseconds.

public HttpConnection.Request timeout (int millis)

Update the request timeout.

Parameters
millis timeout, in milliseconds
Returns
  • this Request, for chaining

public URL url ()

Get the URL

Returns
  • URL

public T extends Base url (URL url)

Set the URL

Parameters
url new URL
Returns
  • this, for chaining