Code example for CookieManager

0
 
  /** 
   * Creates a new CookieManager instance. 
   */ 
  public static CookieHandler newCookieManager() {
    return new CookieManager();
  } 
 
  /** 
   * Clears the cookies in the given cookie handler. Cookies can only be cleared if the 
   * cookieHandler is a CookieManager with a non-null CookieStore. 
   * 
   * @param cookieHandler the cookie handler where cookies should be cleared 
   * @return true if cookies were cleared; false otherwise 
   */ 
  public static boolean clearCookies(CookieHandler cookieHandler) {
    if (cookieHandler instanceof CookieManager) {
      CookieManager cookieManager = (CookieManager) cookieHandler;
      CookieStore cookieStore = cookieManager.getCookieStore();
      if (cookieStore != null) {