This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.net
interface CookieStore


Most common way to construct:

CookieManager manager = …;

CookieStore cookieJar = manager.getCookieStore();

Based on 11 examples


public interface CookieStore

A CookieStore object represents a storage for cookie. Can store and retrieve cookies.

{@link CookieManager} will call CookieStore.add to save cookies for every incoming HTTP response, and call CookieStore.get to retrieve cookie for every outgoing HTTP request. A CookieStore is responsible for removing HttpCookie instances which have expired.

See Also (auto-generated):

CookieHandler

CookieManager

URL


Method Summary
 void
add(URI uri, HttpCookie cookie)

          Adds one HTTP cookie to the store.
 List
get(URI uri)

          Retrieve cookies associated with given URI, or whose domain matches the given URI.
 List

          Get all not-expired cookies in cookie store.
 List

          Get all URIs which identify the cookies in this cookie store.
 boolean
remove(URI uri, HttpCookie cookie)

          Remove a cookie from store.
 boolean

          Remove all cookies in this cookie store.
 

Method Detail

add

public void add(URI uri,
                HttpCookie cookie)
Adds one HTTP cookie to the store. This is called for every incoming HTTP response.

A cookie to store may or may not be associated with an URI. If it is not associated with an URI, the cookie's domain and path attribute will indicate where it comes from. If it is associated with an URI and its domain and path attribute are not speicifed, given URI will indicate where this cookie comes from.

If a cookie corresponding to the given URI already exists, then it is replaced with the new one.

Parameters:
uri - the uri this cookie associated with. if null, this cookie will not be associated with an URI
cookie - the cookie to store

get

public List get(URI uri)
Retrieve cookies associated with given URI, or whose domain matches the given URI. Only cookies that have not expired are returned. This is called for every outgoing HTTP request.

Parameters:
uri
Returns:
an immutable list of HttpCookie, return empty list if no cookies match the given URI

getCookies

public List getCookies()
Get all not-expired cookies in cookie store.

Returns:
an immutable list of http cookies; return empty list if there's no http cookie in store

getURIs

public List getURIs()
Get all URIs which identify the cookies in this cookie store.

Returns:
an immutable list of URIs; return empty list if no cookie in this cookie store is associated with an URI

remove

public boolean remove(URI uri,
                      HttpCookie cookie)
Remove a cookie from store.

Parameters:
uri - the uri this cookie associated with. if null, the cookie to be removed is not associated with an URI when added; if not null, the cookie to be removed is associated with the given URI when added.
cookie - the cookie to remove
Returns:
true if this store contained the specified cookie

removeAll

public boolean removeAll()
Remove all cookies in this cookie store.

Returns:
true if this store changed as a result of the call


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.