Sets the cookie.
514383
public function setCookie()
    {
        $language = current($this->getLanguages());
        if ($language !== Yii::$app->language) {
            $this->cookie->value = Yii::$app->language;
            $this->response->getCookies()->add($this->cookie);
        }
    }
107685
public void setCookies(List<HttpCookie> cookies) {
        if (cookies.isEmpty()) {
            setHeader(HttpHeader.COOKIE, null);
        }

        StringBuilder sbData = new StringBuilder();

        for (HttpCookie c : cookies) {
            sbData.append(c.getName());
            sbData.append('=');
            sbData.append(c.getValue());
            sbData.append("; ");
        }

        if (sbData.length() <= 3) {
            setHeader(HttpHeader.COOKIE, null);
            return;
        }

        final String data = sbData.substring(0, sbData.length() - 2);
        setHeader(HttpHeader.COOKIE, data);
    }
238147
@Override
    public boolean set(HttpCookie cookie, byte[] attribValue) {
        if (null != attribValue && 0 < attribValue.length) {
            cookie.setComment(HttpChannelUtils.getEnglishString(attribValue));
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Cookie Comment set to " + cookie.getComment());
            }
            return true;
        }
        return false;
    }
398447
public function set($name, $value, $path = null, $domain = null, $isSecure = null, \DateTime $expiry = null)
    {
        $cookie = new Cookie($name, $value, $path, $domain, $isSecure, $expiry);

        $this->setCookie($cookie);
    }
567816
public function setCookie($name, $value, $expires, $domain)
	{
		setcookie($name, $value, $expires, $domain);
		$_COOKIE[$name] = $value;
	}
483044
protected function sendCookies()
    {
        foreach ($this->cookies as $cookie) {
            setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpireTimestamp(), $cookie->getPath(),
                $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
        }
    }
754163
def set_cookie_if_ok(self, cookie, request):
        """"""
        self._cookies_lock.acquire()
        try:
            self._policy._now = self._now = int(time.time())

            if self._policy.set_ok(cookie, request):
                self.set_cookie(cookie)


        finally:
            self._cookies_lock.release()
586615
private function setCookiesFromHeaders()
    {
        $this->cookies = [];

        $headers = $this->getHeaderAsArray('Cookie');

        foreach ($headers as $line) {
            foreach (explode(';', $line) as $pair) {
                $cookie = BasicCookie::fromHeader($pair);
                $this->cookies[$cookie->getName()] = $cookie;
            }
        }
    }
779647
public void setCookieData(HttpServletRequest request, HttpServletResponse response) {

        setCookieData(m_pcType, m_username, m_oufqn, request, response);
    }
902504
def add_cookie(self, cookie):
		
		if self.__ro_flag:
			raise RuntimeError('Read-only cookie-jar changing attempt')
		self.__cookies[cookie.name()] = cookie
1003278
public function setCookie(RequestCookie $cookie)
    {
        $this->cookies[$cookie->getName()] = $cookie;
        $this->setHeadersFromCookies();
    }
1199496
@Override
    public void addCookie(Cookie cookie) {
        super.addCookie(cookie);
        if(this.cookies == null) {
            this.cookies = new HashSet<Cookie>();
        }

        this.cookies.add(cookie);
    }
1191253
public function offsetSet($key, $value)
	{
		if ($value instanceOf Cookie)
		{
			$this->jar[$key] = $value;
		}
	}
1199016
public function setLoginCookie()
    {
        $this->setCookies(array(
            self::COOKIE_CART => $this->_hashData(Varien_Date::now()),
            self::COOKIE_SEGMENT => $this->_hashData($this->_getHelper()->getCustomerSegment()),
            self::COOKIE_CUSTOMER => $this->_hashData(Varien_Date::now()),
            self::COOKIE_IS_LOGGED_IN => 1
        ));
    }
298069
public static void setCookieValue(CmsJspActionElement jsp, String name, String value) {

        Cookie[] cookies = jsp.getRequest().getCookies();
        for (int i = 0; (cookies != null) && (i < cookies.length); i++) {
            if (name.equalsIgnoreCase(cookies[i].getName())) {
                cookies[i].setValue(value);
                return;
            }
        }
        Cookie cookie = new Cookie(name, value);
        jsp.getResponse().addCookie(cookie);
    }
200703
public function setCookie($key, $value)
    {
        $this->_cookies[$key] = $value;
        $this->setopt(CURLOPT_COOKIE, http_build_query($this->_cookies, '', '; '));
    }
1330052
protected function initCookie()
    {
        $cookieOptions = Json::encode(
                            array_merge(
                                $this->cookieOptions,
                                [
                                    'classOuter'  => str_replace(' ', '.', $this->classOptions['classOuter']),
                                    'classInner'  => str_replace(' ', '.', $this->classOptions['classInner']),
                                    'classButton' => str_replace(' ', '.', $this->classOptions['classButton']),
                                ]
                            )
                        );
        $view = $this->getView();
        assets\CookieMonsterAsset::register($view);
        $view->registerJs("CookieMonster.init($cookieOptions);");
    }