设置 cookie.value 并设置属性
170404
def set(self, key: str, value: str, opt: dict = None) -> None:
        
        self[key] = value
        if opt is not None:
            self[key].update(opt)
1234522
protected void populateValue(Object entity, EntityType type, String attr, Object value) {
    // 当有深层次属性
    if (Strings.contains(attr, '.')) {
      if (null != foreignerKeys) {
        boolean isForeigner = isForeigner(attr);
        // 如果是个外键,先根据parentPath生成新的外键实体。
        // 因此导入的是外键,只能有一个属性导入.
        if (isForeigner) {
          String parentPath = Strings.substringBeforeLast(attr, ".");
          ObjectAndType propertyType = populator.initProperty(entity, type, parentPath);
          Object property = propertyType.getObj();
          if (property instanceof Entity<?>) {
            if (((Entity<?>) property).isPersisted()) {
              populator.populateValue(entity, type, parentPath, null);
              populator.initProperty(entity, type, parentPath);
            }
          }
        }
      }
    }
    if (!populator.populateValue(entity, type, attr, value)) {
      transferResult.addFailure(descriptions.get(attr) + " data format error.", value);
    }
  }
347092
public void setCookie(final String name, final String value) {
		if (name != null) {
			Cookie cookie = new Cookie(name, value);
			cookies.put(name, cookie);
		}
	}
49728
private Cookie createCookie(String str) throws UnsupportedEncodingException {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Cookie name = " + AUTH_COOKIE + " value = " + str);
    }
    Cookie cookie = new Cookie(AUTH_COOKIE, str);

    cookie.setMaxAge(cookieMaxAge);
    if (cookieDomain != null) {
      cookie.setDomain(cookieDomain);
    }
    if (cookiePath != null) {
      cookie.setPath(cookiePath);
    }
    cookie.setSecure(isCookieSecure);
    return cookie;
  }
588929
private byte[] berEncodedValue() {
        final byte[] cookieSize = NumberFacility.leftTrim(NumberFacility.getBytes(cookie.length));
        final byte[] size = NumberFacility.leftTrim(NumberFacility.getBytes(14 + cookieSize.length + cookie.length));

        final ByteBuffer buff = ByteBuffer.allocate(1 + 1 + size.length + 14 + cookieSize.length + cookie.length);

        buff.put((byte) 0x30); // (Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
        buff.put((byte) (size.length == 1 ? 0x81 : size.length == 2 ? 0x82 : 0x83)); // size type (short or long form)
        buff.put(size); // sequence size
        buff.put((byte) 0x02); // 4bytes int tag
        buff.put((byte) 0x04); // int size
        buff.putInt(flags); // flags
        buff.put((byte) 0x02); // 4bytes int tag
        buff.put((byte) 0x04); // int size
        buff.putInt(Integer.MAX_VALUE); // max attribute count
        buff.put((byte) 0x04); // byte array tag
        buff.put((byte) (cookieSize.length == 1 ? 0x81 : cookieSize.length == 2 ? 0x82 : 0x83)); // short or long form
        buff.put(cookieSize); // byte array size
        if (cookie.length > 0) {
            buff.put(cookie); // (cookie, Ber.ASN_OCTET_STR);
        }
        return buff.array();
    }
262387
function set(key, value, opt_force, opt_data) {

    var type   = this.getType(key);
    var old    = this[type][key];
    var isFire = false;

    //设置value
    if (type === 'nodes'){
      this._setNode(key, value);
    } else{
      this[type][key] = value;
    }

    //判断时候触发事件
    if (type === 'attributes'){
      if (value != old || opt_force === true) isFire = true;
    } else {
      if (opt_force) isFire = 1;
    }

    //触发事件
    if (isFire && opt_force !== false){

      opt_data = opt_data || {};
      opt_data.old = old;
      opt_data.now = value;
      opt_data.target = this;

      this.emit('change:' + key, opt_data);
      isFire === true && this.emit('change:' + key + ':'+value, opt_data);

    }

    return this;
  }
681014
function serializeCookie(cookie) {
  return {
    path: cookie.path,
    name: cookie.key,
    value: cookie.value,
    domain: cookie.domain
  };
}
1374629
public boolean set(String field, Object value) {
		boolean result = false;
		if(value == null)return false;
		//返回值（1:新字段被设置,0:已经存在值被更新）
		try {
			if (isCluster(groupName)) {
				result = getBinaryJedisClusterCommands(groupName)
						.hset(keyBytes, SafeEncoder.encode(field), valueSerialize(value)) >= 0;
			} else {
				result = getBinaryJedisCommands(groupName).hset(keyBytes, SafeEncoder.encode(field), valueSerialize(value)) >= 0;
			}		
			//设置超时时间
			if(result)setExpireIfNot(expireTime);
			return result;
		} finally {
			getJedisProvider(groupName).release();
		}
	}
967070
public String encode(String name, String value) {
        return encode(new DefaultCookie(name, value));
    }
225982
function parseCookies(str) {
  var cookies = {};

  var ary = (str || '').split(/;\s+/);
  _.map(ary, function(ck) {
    var parsed = ck.trim().split('=');
    cookies[parsed[0]] = parsed[1];
  });

  return cookies;
}
1098941
public static void storeSessionDataInCookie(String key, String value, ServletResponse response)
	{
		Cookie cookie = new Cookie(key, value);
		cookie.setPath("/");
		cookie.setMaxAge(-1);//expire when browser closes
		((HttpServletResponse) response).addCookie(cookie);
	}
642146
public void setCookie(String name, String value, String path, long maxAge, boolean secure, boolean httpOnly) {
        Date now = new Date();
        Date expirationDate = new Date(now.getTime() + maxAge);
        setCookie(name, value, path, expirationDate, secure, httpOnly);
    }
466545
def set_response_cookie(response, cookie_name, cookie_value):
    
    now = timezone.now()
    expire_date = now + datetime.timedelta(days=365)
    response.set_cookie(cookie_name, cookie_value, expires=expire_date)
743744
function JSONCookie (str) {
  if (typeof str !== 'string' || str.substr(0, 2) !== 'j:') {
    return undefined
  }

  try {
    return JSON.parse(str.slice(2))
  } catch (err) {
    return undefined
  }
}
715009
function (name) {
    if ($.cookie(this.cookieName)) {
      var cookieVals = $.cookie(this.cookieName).split("|");
      for (var i = 0; i < cookieVals.length; i++) {
        var fieldVals = cookieVals[i].split("~");
        if (fieldVals[0] == name) {
          return fieldVals[1];
        }
      }
    }
    return false;
  }
1266700
function convertCookie (value, converter) {
  if (value.indexOf('"') === 0) {
    // this is a quoted cookied according to RFC2068
    // remove enclosing quotes and internal quotes and backslashes
    value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  }

  let parsedValue;
  try {
    parsedValue = decodeURIComponent(value.replace(/\+/g, ' '));
  } catch (e) {
    // no need to fail if we can't decode
    log.warn(e);
  }

  return converter ? converter(parsedValue) : parsedValue;
}
486498
public HttpResponse withCookie(String name, String value) {
        this.cookies.withEntry(name, value);
        return this;
    }