com.teamdev.jxbrowser.cookie
Class HttpCookieStorage

java.lang.Object
  extended by com.teamdev.jxbrowser.cookie.HttpCookieStorage
Direct Known Subclasses:
IECookieStorage, MozillaCookieStorage, SafariCookieStorage

public abstract class HttpCookieStorage
extends java.lang.Object

Represents HTTP cookie storage.


Constructor Summary
HttpCookieStorage()
           
 
Method Summary
abstract  void deleteCookie(HttpCookie cookie)
          Deletes the specified cookie.
abstract  void deleteCookie(java.util.List<HttpCookie> cookies)
          Deletes all cookies from a given list of cookies.
abstract  java.util.List<HttpCookie> getCookies()
          Returns the list of available cookies.
abstract  java.util.List<HttpCookie> getCookies(java.lang.String url)
          Returns the list of available cookies that will be sent to a specified URL.
static HttpCookieStorage getInstance(BrowserType browserType)
          Returns the HttpCookieStorage for a given browserType.
abstract  void setCookie(HttpCookie cookie, java.lang.String url)
          Stores a specified cookie in browser's cookie storage.
abstract  void setCookie(java.util.List<HttpCookie> cookies, java.lang.String url)
          Stores cookies from a given list of cookies in browser's cookie storage.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpCookieStorage

public HttpCookieStorage()
Method Detail

getCookies

public abstract java.util.List<HttpCookie> getCookies()
Returns the list of available cookies.

Returns:
the list of available cookies or an empty list if no cookie available.

getCookies

public abstract java.util.List<HttpCookie> getCookies(java.lang.String url)
Returns the list of available cookies that will be sent to a specified URL.

Parameters:
url - the URL to filter on.
Returns:
the list of cookies whose URL matches the provided URL.

setCookie

public abstract void setCookie(HttpCookie cookie,
                               java.lang.String url)
Stores a specified cookie in browser's cookie storage.

The cookies will replace existing cookies with the same name, domain, and path, if one exists in the cookie storage.

Parameters:
cookie - the cookie to store.
url - the URL associated with the added cookies.

setCookie

public abstract void setCookie(java.util.List<HttpCookie> cookies,
                               java.lang.String url)
Stores cookies from a given list of cookies in browser's cookie storage.

The cookies will replace existing cookies with the same name, domain, and path, if one exists in the cookie storage.

Parameters:
cookies - the list of cookies to store.
url - the URL associated with the added cookies.

deleteCookie

public abstract void deleteCookie(HttpCookie cookie)
Deletes the specified cookie.

Parameters:
cookie - the cookie to delete.

deleteCookie

public abstract void deleteCookie(java.util.List<HttpCookie> cookies)
Deletes all cookies from a given list of cookies.

Parameters:
cookies - the list of cookies to delete.

getInstance

public static HttpCookieStorage getInstance(BrowserType browserType)
Returns the HttpCookieStorage for a given browserType. Different browser engines have their own HttpCookieStorage. Browser engine's cookie storages do not have access the one of the other.

Parameters:
browserType - a browser engine type for which cookie storage is required.
Returns:
the HttpCookieStorage for a given browserType.
Throws:
UnsupportedBrowserTypeException - when a given browserType doesn't provide any cookie storage.