APIdia Launch Partner
Top Description Fields Constructors Methods
java.net

pack-priv Class InMemoryCookieStore

extends Object
implements CookieStore
Class Inheritance
All Implemented Interfaces
java.net.CookieStore
Imports
java.util.List, .Map, .ArrayList, .HashMap, .Collections, .Iterator, java.util.concurrent.locks.ReentrantLock

A simple in-memory java.net.CookieStore implementation
Author
Edward Wang
Since
1.6

Field Summary

Modifier and TypeField and Description
private List<HttpCookie>
private Map<String, List<HttpCookie>>
private ReentrantLock
private Map<URI, List<HttpCookie>>

Constructor Summary

AccessConstructor and Description
public
InMemoryCookieStore()

The default ctor

Method Summary

Modifier and TypeMethod and Description
public void
add(URI uri, HttpCookie cookie)

Implements java.net.CookieStore.add.

Add one cookie into cookie store.

private <T> void
addIndex(Map<T, List<HttpCookie>> indexStore, T index, HttpCookie cookie)

public List<HttpCookie>
get(URI uri)

Implements java.net.CookieStore.get.

Get all cookies, which: 1) given uri domain-matches with, or, associated with given uri when added to the cookie store.

public List<HttpCookie>
getCookies()

Implements java.net.CookieStore.getCookies.

Get all cookies in cookie store, except those have expired

private URI
private void
getInternal1(List<HttpCookie> cookies, Map<String, List<HttpCookie>> cookieIndex, String host, boolean secureLink)

private <T> void
getInternal2(List<HttpCookie> cookies, Map<T, List<HttpCookie>> cookieIndex, Comparable<T> comparator, boolean secureLink)

public List<URI>
getURIs()

Implements java.net.CookieStore.getURIs.

Get all URIs, which are associated with at least one cookie of this cookie store.

private boolean
public boolean
remove(URI uri, HttpCookie ck)

Implements java.net.CookieStore.remove.

Remove a cookie from store

public boolean
removeAll()

Implements java.net.CookieStore.removeAll.

Remove all cookies in this cookie store.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cookieJarback to summary
private List<HttpCookie> cookieJar
domainIndexback to summary
private Map<String, List<HttpCookie>> domainIndex
lockback to summary
private ReentrantLock lock
uriIndexback to summary
private Map<URI, List<HttpCookie>> uriIndex

Constructor Detail

InMemoryCookieStoreback to summary
public InMemoryCookieStore()

The default ctor

Method Detail

addback to summary
public void add(URI uri, HttpCookie cookie)

Implements java.net.CookieStore.add.

Add one cookie into cookie store.

Annotations
@Override
addIndexback to summary
private <T> void addIndex(Map<T, List<HttpCookie>> indexStore, T index, HttpCookie cookie)
getback to summary
public List<HttpCookie> get(URI uri)

Implements java.net.CookieStore.get.

Get all cookies, which: 1) given uri domain-matches with, or, associated with given uri when added to the cookie store. 3) not expired. See RFC 2965 sec. 3.3.4 for more detail.

Annotations
@Override
getCookiesback to summary
public List<HttpCookie> getCookies()

Implements java.net.CookieStore.getCookies.

Get all cookies in cookie store, except those have expired

Annotations
@Override
getEffectiveURIback to summary
private URI getEffectiveURI(URI uri)
getInternal1back to summary
private void getInternal1(List<HttpCookie> cookies, Map<String, List<HttpCookie>> cookieIndex, String host, boolean secureLink)
getInternal2back to summary
private <T> void getInternal2(List<HttpCookie> cookies, Map<T, List<HttpCookie>> cookieIndex, Comparable<T> comparator, boolean secureLink)
getURIsback to summary
public List<URI> getURIs()

Implements java.net.CookieStore.getURIs.

Get all URIs, which are associated with at least one cookie of this cookie store.

Annotations
@Override
netscapeDomainMatchesback to summary
private boolean netscapeDomainMatches(String domain, String host)
removeback to summary
public boolean remove(URI uri, HttpCookie ck)

Implements java.net.CookieStore.remove.

Remove a cookie from store

Annotations
@Override
removeAllback to summary
public boolean removeAll()

Implements java.net.CookieStore.removeAll.

Remove all cookies in this cookie store.

Annotations
@Override