com.teamdev.jxbrowser.cookies
Class CookieManager

java.lang.Object
  extended by com.teamdev.jxbrowser.cookies.CookieManager

public class CookieManager
extends java.lang.Object

Provide cookies support


Constructor Summary
CookieManager()
          Construct new cookie manager
 
Method Summary
 java.util.Set<Cookie> getAllCookies()
           
 int getCookiesCount(java.lang.String host)
          Returns count of available cookies for a given host, ignoring the cookie flags Cookie.isSecure(), and Cookie.isHttpOnly().
 void importCookies(java.io.File cookieFile)
          Import an old-style cookie file.
 void remove(java.lang.String domain, java.lang.String name, java.lang.String path, boolean blocked)
          Called to remove an individual cookie from the cookie list
 void removeAll()
          Called to remove all cookies from the cookie list (e.g clear cookies)
 void setCookie(Cookie cookie)
          Adds new cookie object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieManager

public CookieManager()
Construct new cookie manager

Method Detail

setCookie

public void setCookie(Cookie cookie)
Adds new cookie object

Parameters:
cookie - the cookie object.
See Also:
Cookie

importCookies

public void importCookies(java.io.File cookieFile)
Import an old-style cookie file. Imported cookies will be added to the existing database. If the database contains any cookies the same as those being imported (i.e. domain, name, and path match), they will be replaced.

Parameters:
cookieFile - the file to import, usually cookies.txt

getCookiesCount

public int getCookiesCount(java.lang.String host)
Returns count of available cookies for a given host, ignoring the cookie flags Cookie.isSecure(), and Cookie.isHttpOnly(). Thus, for a host "weather.yahoo.com", host or domain cookies for "weather.yahoo.com" and "yahoo.com" would be counted, while a cookie for "my.weather.yahoo.com" would not.

Parameters:
host - the host string to look for, e.g. "google.com". this should consist of only the host portion of a URI, and should not contain a leading dot, a port, etc.
Returns:
the number of cookies for a given host.

remove

public void remove(java.lang.String domain,
                   java.lang.String name,
                   java.lang.String path,
                   boolean blocked)
Called to remove an individual cookie from the cookie list

Parameters:
domain - the host or domain for which the cookie was set
name - the name specified in the cookie
path - path within the domain for which the cookie is valid
blocked - Indicates if cookies from this host should be permanently blocked

getAllCookies

public java.util.Set<Cookie> getAllCookies()
Returns:
the set of all existed cookies

removeAll

public void removeAll()
Called to remove all cookies from the cookie list (e.g clear cookies)