Interface HttpCookieStore

All Known Implementing Classes:
HttpCookieStore.Default, HttpCookieStore.Empty

public interface HttpCookieStore

A container for HttpCookies.

HTTP cookies are stored along with a URI via add(URI, HttpCookie) and retrieved via match(URI), which implements the path matching algorithm defined by RFC 6265.

  • Method Details

    • add

      boolean add(URI uri, HttpCookie cookie)

      Adds a cookie to this store, if possible.

      The cookie may not be added for various reasons; for example, it may be already expired, or its domain attribute does not match that of the URI, etc.

      The cookie is associated with the given URI, so that a call to match(URI) returns the cookie only if the URIs match.

      Parameters:
      uri - the URI associated with the cookie
      cookie - the cookie to add
      Returns:
      whether the cookie has been added
    • all

      Returns:
      all the cookies
    • match

      List<HttpCookie> match(URI uri)

      Returns the cookies that match the given URI.

      Parameters:
      uri - the URI to match against
      Returns:
      a list of cookies that match the given URI
    • remove

      boolean remove(URI uri, HttpCookie cookie)

      Removes the cookie associated with the given URI.

      Parameters:
      uri - the URI associated with the cookie to remove
      cookie - the cookie to remove
      Returns:
      whether the cookie has been removed
    • clear

      boolean clear()

      Removes all the cookies from this store.

      Returns:
      whether the store modified by this call