com.sun.xml.ws.transport.http.client
Class InMemoryCookieStore

java.lang.Object
  extended by com.sun.xml.ws.transport.http.client.InMemoryCookieStore
All Implemented Interfaces:
CookieStore

 class InMemoryCookieStore
extends Object
implements CookieStore

A simple in-memory java.net.CookieStore implementation

Since:
1.6

Constructor Summary
InMemoryCookieStore()
          The default ctor
 
Method Summary
 void add(URI uri, HttpCookie cookie)
          Add one cookie into cookie store.
 List<HttpCookie> get(URI uri)
          Get all cookies, which: 1) given uri domain-matches with, or, associated with given uri when added to the cookie store.
 List<HttpCookie> getCookies()
          Get all cookies in cookie store, except those have expired
 List<URI> getURIs()
          Get all URIs, which are associated with at least one cookie of this cookie store.
 boolean remove(URI uri, HttpCookie ck)
          Remove a cookie from store
 boolean removeAll()
          Remove all cookies in this cookie store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryCookieStore

InMemoryCookieStore()
The default ctor

Method Detail

add

public void add(URI uri,
                HttpCookie cookie)
Add one cookie into cookie store.

Specified by:
add in interface CookieStore
Parameters:
uri - the uri this cookie associated with. if null, this cookie will not be associated with an URI
cookie - the cookie to store
See Also:
CookieStore.get(java.net.URI)

get

public List<HttpCookie> get(URI uri)
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.

Specified by:
get in interface CookieStore
Returns:
an immutable list of HttpCookie, return empty list if no cookies match the given URI
See Also:
CookieStore.add(java.net.URI, com.sun.xml.ws.transport.http.client.HttpCookie)

getCookies

public List<HttpCookie> getCookies()
Get all cookies in cookie store, except those have expired

Specified by:
getCookies in interface CookieStore
Returns:
an immutable list of http cookies; return empty list if there's no http cookie in store

getURIs

public List<URI> getURIs()
Get all URIs, which are associated with at least one cookie of this cookie store.

Specified by:
getURIs in interface CookieStore
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 ck)
Remove a cookie from store

Specified by:
remove in interface CookieStore
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.
ck - the cookie to remove
Returns:
true if this store contained the specified cookie

removeAll

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

Specified by:
removeAll in interface CookieStore
Returns:
true if this store changed as a result of the call


Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.