本文整理匯總了Java中java.net.CookieStore.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java CookieStore.remove方法的具體用法?Java CookieStore.remove怎麽用?Java CookieStore.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.net.CookieStore
的用法示例。
在下文中一共展示了CookieStore.remove方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: clearAuthorizationData
import java.net.CookieStore; //導入方法依賴的package包/類
/**
* Clear the local stored authorization data
*/
public void clearAuthorizationData() {
preferences.accessToken.clear();
preferences.idToken.clear();
preferences.userIdentity.clear();
if (BMSClient.getInstance() != null && BMSClient.getInstance().getCookieManager() != null) {
CookieStore cookieStore = BMSClient.getInstance().getCookieManager().getCookieStore();
if(cookieStore != null) {
for (URI uri : cookieStore.getURIs()) {
for (HttpCookie cookie : cookieStore.get(uri)) {
if (cookie.getName().equals(TAI_COOKIE_NAME)) {
cookieStore.remove(uri, cookie);
}
}
}
}
}
}
開發者ID:ibm-bluemix-mobile-services,項目名稱:bms-clientsdk-android-core,代碼行數:21,代碼來源:MCAAuthorizationManager.java
示例2: resetCookie
import java.net.CookieStore; //導入方法依賴的package包/類
private void resetCookie() {
settings.edit().remove(prefKey).apply();
authCookie = "";
try {
/*
This step is *required* for PNA, and nicety for other services. PNA won't let you
log in if you're still holding on to a valid authcookie, so we clear them out.
*/
URI loginURI = URI.create(url.getHost());
CookieStore cookies = ((CookieManager) CookieHandler.getDefault()).getCookieStore();
for (HttpCookie cookie : cookies.get(loginURI)) {
cookies.remove(loginURI, cookie);
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
cookieHasBeenSet = false;
}
示例3: shouldBeAbleToRemoveCookie
import java.net.CookieStore; //導入方法依賴的package包/類
@Test
public void shouldBeAbleToRemoveCookie() {
addCookies(1, false);
CookieStore store = new CookieTray(preferences);
store.remove(URI.create("http://google.com/home0"), new HttpCookie("name0", "value0"));
verify(editor).remove("http://google.com/home0|name0");
}
示例4: 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");
}
示例5: 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();
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");
}