コード例 #1
0
  /*
   * Takes the initial client cookie value, if any (null otherwise), as well
   * as the page load timestamp and creates initial states.
   */
  protected void initCookieStates(String plainCookieId, String etagCookieId) {
    CookieStates states = getCookieStates();
    CookieState plainState;
    ZombieCookie cookie = null;

    if (plainCookieId == null) {
      // may be overridden to UNSUPPORTED after javascript info received
      plainState = NEW;
    } else if ((cookie = lookupZombieCookie(plainCookieId)) != null) {
      if (cookie.hasParent()) {
        cookie = cookie.oldestRelative();
        plainState = REPLACED_BY_OLDER_PLAIN_COOKIE;
      } else {
        plainState = EXISTING;
      }
    } else {
      plainState = RESET;
    }

    if (cookie == null) {
      cookie = createZombieCookie();
    }

    setAndSaveZombieCookie(cookie);
    states.setPlainState(plainState);
    updateCookieStates(ETAG, etagCookieId);
  }
コード例 #2
0
  protected void updateCookieStates(JsData jsData, boolean deviceCookieReceived) {
    CookieStates states = getCookieStates();

    if (!deviceCookieReceived) {
      // There has been a full round trip with the client, so we know for
      // sure if cookies are supported at this point.  We override
      // the previous value of NEW or RESTORED_FROM_*
      states.setPlainState(NOT_SUPPORTED);
    }

    if (jsData.getWebLocalStorageTest() != Boolean.TRUE) {
      states.setWebStorageState(NOT_SUPPORTED);
    }
  }