public static interface

Connection.Base

org.jsoup.Connection.Base<T extends org.jsoup.Connection.Base>
Known Indirect Subclasses

Class Overview

Common methods for Requests and Responses

Summary

Public Methods
abstract T cookie(String name, String value)
Set a cookie in this request/response.
abstract String cookie(String name)
Get a cookie value by name from this request/response.
abstract Map<StringString> cookies()
Retrieve all of the request/response cookies as a map
abstract boolean hasCookie(String name)
Check if a cookie is present
abstract boolean hasHeader(String name)
Check if a header is present
abstract T header(String name, String value)
Set a header.
abstract String header(String name)
Get the value of a header.
abstract Map<StringString> headers()
Retrieve all of the request/response headers as a map
abstract Connection.Method method()
Get the request method
abstract T method(Connection.Method method)
Set the request method
abstract T removeCookie(String name)
Remove a cookie by name
abstract T removeHeader(String name)
Remove a header by name
abstract URL url()
Get the URL
abstract T url(URL url)
Set the URL

Public Methods

public abstract T 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 abstract 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 abstract Map<StringString> cookies ()

Retrieve all of the request/response cookies as a map

Returns
  • cookies

public abstract 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 abstract 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 abstract T 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 abstract 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 abstract Map<StringString> headers ()

Retrieve all of the request/response headers as a map

Returns
  • headers

public abstract Connection.Method method ()

Get the request method

Returns
  • method

public abstract T method (Connection.Method method)

Set the request method

Parameters
method new method
Returns
  • this, for chaining

public abstract T removeCookie (String name)

Remove a cookie by name

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

public abstract T removeHeader (String name)

Remove a header by name

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

public abstract URL url ()

Get the URL

Returns
  • URL

public abstract T url (URL url)

Set the URL

Parameters
url new URL
Returns
  • this, for chaining