List of usage examples for com.google.gwt.user.client Cookies removeCookie
public static void removeCookie(String name)
From source file:com.data2semantics.yasgui.client.helpers.LocalStorageHelper.java
License:Open Source License
public static void setAsCookie(String key, String value, int expireDays) { key = Helper.getCurrentHost() + "_" + key; Cookies.removeCookie(key); Cookies.setCookie(key, value, getExpireDate(expireDays)); }
From source file:com.data2semantics.yasgui.client.helpers.LocalStorageHelper.java
License:Open Source License
public static String getAsCookie(String key) { String domain = Helper.getCurrentHost(); if (Cookies.getCookie(domain + "_" + key) != null) { return Cookies.getCookie(domain + "_" + key); } else if (Cookies.getCookie(key) != null) { //for backwards compatability (i.e. the time when we didnt use the basedomain as part of the key) String value = Cookies.getCookie(key); setAsCookie(key, value, UNKNOWN_EXPIRE_DAYS); //now store it under correct key Cookies.removeCookie(key);//remove old key return value; }/*from w w w. j a v a2 s . co m*/ return null; }
From source file:com.dawg6.web.dhcalc.client.BasePanel.java
License:Open Source License
protected boolean loadStorage() { boolean result = false; if (Storage.isLocalStorageSupported()) { Storage storage = Storage.getLocalStorageIfSupported(); Collection<String> cookies = null; if (Cookies.isCookieEnabled()) { cookies = Cookies.getCookieNames(); }/*from ww w.j a v a 2s . co m*/ for (Field f : getFields()) { String value = storage.getItem(f.name); if (value != null) { // do nothing } else if ((cookies != null) && (cookies.contains(f.name))) { value = getCookie(f.name, f.defaultValue); storage.setItem(f.name, value); Cookies.removeCookie(f.name); } else { value = f.defaultValue; storage.setItem(f.name, value); } setFieldValue(f, value); } result = true; } return result; }
From source file:com.eucalyptus.webui.client.session.LocalSessionImpl.java
License:Open Source License
@Override public void clearSession() { this.session = null; Cookies.removeCookie(SESSION_COOKIE_NAME); }
From source file:com.google.gerrit.client.Gerrit.java
License:Apache License
static void deleteSessionCookie() { myAccount = null;/*w w w . j a v a2 s.c o m*/ myAccountDiffPref = null; xGerritAuth = null; refreshMenuBar(); // If the cookie was HttpOnly, this request to delete it will // most likely not be successful. We can try anyway though. // Cookies.removeCookie("GerritAccount"); }
From source file:com.google.gwt.sample.feedreader.client.Configuration.java
License:Apache License
/** * Delete the application's configuration. */ public void reset() { Cookies.removeCookie(COOKIE_NAME); getFeeds().clear(); initialize(); }
From source file:com.google.gwt.sample.showcase.client.content.other.CwCookies.java
License:Apache License
/** * Initialize this example.//w ww . java 2s . c o m */ @ShowcaseSource @Override public Widget onInitialize() { // Create the panel used to layout the content Grid mainLayout = new Grid(3, 3); // Display the existing cookies existingCookiesBox = new ListBox(); Button deleteCookieButton = new Button(constants.cwCookiesDeleteCookie()); deleteCookieButton.addStyleName("sc-FixedWidthButton"); mainLayout.setHTML(0, 0, "<b>" + constants.cwCookiesExistingLabel() + "</b>"); mainLayout.setWidget(0, 1, existingCookiesBox); mainLayout.setWidget(0, 2, deleteCookieButton); // Display the name of the cookie cookieNameBox = new TextBox(); mainLayout.setHTML(1, 0, "<b>" + constants.cwCookiesNameLabel() + "</b>"); mainLayout.setWidget(1, 1, cookieNameBox); // Display the name of the cookie cookieValueBox = new TextBox(); Button setCookieButton = new Button(constants.cwCookiesSetCookie()); setCookieButton.addStyleName("sc-FixedWidthButton"); mainLayout.setHTML(2, 0, "<b>" + constants.cwCookiesValueLabel() + "</b>"); mainLayout.setWidget(2, 1, cookieValueBox); mainLayout.setWidget(2, 2, setCookieButton); // Add a handler to set the cookie value setCookieButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String name = cookieNameBox.getText(); String value = cookieValueBox.getText(); Date expires = new Date((new Date()).getTime() + COOKIE_TIMEOUT); // Verify the name is valid if (name.length() < 1) { Window.alert(constants.cwCookiesInvalidCookie()); return; } // Set the cookie value Cookies.setCookie(name, value, expires); refreshExistingCookies(name); } }); // Add a handler to select an existing cookie existingCookiesBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { updateExstingCookie(); } }); // Add a handler to delete an existing cookie deleteCookieButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int selectedIndex = existingCookiesBox.getSelectedIndex(); if (selectedIndex > -1 && selectedIndex < existingCookiesBox.getItemCount()) { String cookieName = existingCookiesBox.getValue(selectedIndex); Cookies.removeCookie(cookieName); existingCookiesBox.removeItem(selectedIndex); updateExstingCookie(); } } }); // Return the main layout refreshExistingCookies(null); return mainLayout; }
From source file:com.googlesource.gerrit.plugins.emoticons.client.EmoticonsPreferenceScreen.java
License:Apache License
@Override protected void onSave() { super.onSave(); Cookies.removeCookie(Plugin.get().getPluginName() + "~prefs"); }
From source file:com.gwtmodel.table.Utils.java
License:Apache License
public static void RemoveCookie(String key) { Cookies.removeCookie(jPrefix() + key); }
From source file:com.gwtplatform.carstore.client.application.login.LoginPresenter.java
License:Apache License
private void setLoggedInCookie(String value) { Cookies.removeCookie(LOGIN_COOKIE_NAME); Date expires = new Date(); CalendarUtil.addDaysToDate(expires, 14); String domain = getDomain();//w w w .j a va2 s . c o m String path = "/"; boolean secure = false; Cookies.setCookie(LOGIN_COOKIE_NAME, value, expires, domain, path, secure); logger.info("LoginPresenter.setLoggedInCookie() Set client cookie=" + value); }