當前位置: 首頁>>代碼示例>>Java>>正文


Java CookieStore.removeAll方法代碼示例

本文整理匯總了Java中java.net.CookieStore.removeAll方法的典型用法代碼示例。如果您正苦於以下問題:Java CookieStore.removeAll方法的具體用法?Java CookieStore.removeAll怎麽用?Java CookieStore.removeAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.net.CookieStore的用法示例。


在下文中一共展示了CookieStore.removeAll方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldBeAbleToRemoveAllCookies

import java.net.CookieStore; //導入方法依賴的package包/類
@Test
public void shouldBeAbleToRemoveAllCookies() {
    doReturn(editor).when(editor).clear();
    CookieStore store = new CookieTray(preferences);
    store.removeAll();
    verify(editor).clear();
    assertTrue("No cookies should be present after removing", store.getCookies().isEmpty());
}
 
開發者ID:abohomol,項目名稱:cookietray,代碼行數:9,代碼來源:CookieTrayTest.java

示例2: clearNetCookies

import java.net.CookieStore; //導入方法依賴的package包/類
/**
 * clear net cookies
 */
public static void clearNetCookies() {
    java.net.CookieManager cookieManager = getCookieManager();
    CookieStore cookieStore = cookieManager.getCookieStore();
    if (cookieStore != null) {
        cookieStore.removeAll();
    }
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:11,代碼來源:CookieManager.java

示例3: checkCookieNullUri

import java.net.CookieStore; //導入方法依賴的package包/類
static void checkCookieNullUri() throws Exception {
    //get a cookie store implementation and add a cookie to the store with null URI
    CookieStore cookieStore = (new CookieManager()).getCookieStore();
    //Check if removeAll() retrurns false on an empty CookieStore
    if (cookieStore.removeAll()) {
        fail = true;
    }
    checkFail("removeAll on empty store should return false");
    HttpCookie cookie = new HttpCookie("MY_COOKIE", "MY_COOKIE_VALUE");
    cookie.setDomain("foo.com");
    cookieStore.add(null, cookie);

    //Retrieve added cookie
    URI uri = new URI("http://foo.com");
    List<HttpCookie> addedCookieList = cookieStore.get(uri);

    //Verify CookieStore behaves well
    if (addedCookieList.size() != 1) {
       fail = true;
    }
    checkFail("Abnormal size of cookie jar");

    for (HttpCookie chip : addedCookieList) {
        if (!chip.equals(cookie)) {
             fail = true;
        }
    }
    checkFail("Cookie not retrieved from Cookie Jar");
    boolean ret = cookieStore.remove(null,cookie);
    if (!ret) {
        fail = true;
    }
    checkFail("Abnormal removal behaviour from Cookie Jar");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:35,代碼來源:NullUriCookieTest.java

示例4: clearCookies

import java.net.CookieStore; //導入方法依賴的package包/類
/**
 * 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) {
      cookieStore.removeAll();
      return true;
    }
  }
  return false;
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:19,代碼來源:GingerbreadUtil.java

示例5: deauthorize

import java.net.CookieStore; //導入方法依賴的package包/類
/**
 * Remove authorization by removing session cookie
 */
static void deauthorize() {
    if (cookieManager != null) {
        CookieStore store = cookieManager.getCookieStore();
        store.removeAll();
    }
}
 
開發者ID:bfabiszewski,項目名稱:ulogger-android,代碼行數:10,代碼來源:WebHelper.java

示例6: initInMemoryCookieStore

import java.net.CookieStore; //導入方法依賴的package包/類
public static CookieStore initInMemoryCookieStore() {
    CookieStore cookieStore = CookieStoreHolder.getCookieStore();
    if (cookieStore == null) {
        CookieManager cm = new CookieManager();
        cm.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
        CookieStoreHolder.setCookieStore(cm.getCookieStore());
    } else {
        cookieStore.removeAll();
    }

    return cookieStore;
}
 
開發者ID:clstoulouse,項目名稱:motu,代碼行數:13,代碼來源:CookieStoreHolder.java

示例7: clearDownloaderCookies

import java.net.CookieStore; //導入方法依賴的package包/類
private static void clearDownloaderCookies() {
  CookieHandler handler = CookieHandler.getDefault();
  if (handler != null && handler instanceof CookieManager) {
    CookieStore cookies = ((CookieManager) handler).getCookieStore();
    cookies.removeAll();
    CookieHandler.setDefault(null);
  }
}
 
開發者ID:paristote,項目名稱:mobile-android-studio,代碼行數:9,代碼來源:ExoPicasso.java

示例8: logoutAll

import java.net.CookieStore; //導入方法依賴的package包/類
public void logoutAll() {
    for (AuthCookie authCookie : authCookies.values()) {
        authCookie.logout();
    }
    CookieStore cookies = ((CookieManager) CookieHandler.getDefault()).getCookieStore();
    cookies.removeAll();
}
 
開發者ID:NasaGeek,項目名稱:utexas-utilities,代碼行數:8,代碼來源:UTilitiesApplication.java


注:本文中的java.net.CookieStore.removeAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。