设定返回给客户端的Cookie<br>
Path: "/"<br>
No Domain

@param name cookie名
@param value cookie值
@param maxAgeInSeconds -1: 关闭浏览器清除Cookie. 0: 立即清除Cookie. n>0 : Cookie存在的秒数.
968859
public final static void addCookie(String name, String value, int maxAgeInSeconds) {
		addCookie(name, value, maxAgeInSeconds, "/", null);
	}
1360895
public RouteContext cookie(String name, String value) {
        this.response.cookie(name, value);
        return this;
    }
623420
public static void setCookie(String name, String value, int maxAge, HttpServletRequest request, HttpServletResponse response) {
		boolean httpOnly = false;
		CookieUtil.setCookie(name, value, maxAge, httpOnly, request, response);
	}
757080
def set_cookie(self, name: str, value: str, *,
                   expires: Optional[str]=None,
                   domain: Optional[str]=None,
                   max_age: Optional[Union[int, str]]=None,
                   path: str='/',
                   secure: Optional[str]=None,
                   httponly: Optional[str]=None,
                   version: Optional[str]=None) -> None:
        

        old = self._cookies.get(name)
        if old is not None and old.coded_value == '':
            # deleted cookie
            self._cookies.pop(name, None)

        self._cookies[name] = value
        c = self._cookies[name]

        if expires is not None:
            c['expires'] = expires
        elif c.get('expires') == 'Thu, 01 Jan 1970 00:00:00 GMT':
            del c['expires']

        if domain is not None:
            c['domain'] = domain

        if max_age is not None:
            c['max-age'] = str(max_age)
        elif 'max-age' in c:
            del c['max-age']

        c['path'] = path

        if secure is not None:
            c['secure'] = secure
        if httponly is not None:
            c['httponly'] = httponly
        if version is not None:
            c['version'] = version
768786
public static function cookie($name, $value = null, $expire = null, $path = null, $domain = null, $security = null) {
        $settings       = App::cfg();
        $cookie_setting = array_merge2([
            'expire'   => 0,
            'path'     => '/',
            'domain'   => '',
            'security' => false
        ], $settings->get('cookie', []));
        if ($expire == null) {
            $expire = intval($cookie_setting ['expire']);
        }
        if ($path == null) {
            $path = $cookie_setting ['path'];
        }
        if ($domain == null) {
            $domain = $cookie_setting ['domain'];
        }
        if ($security == null) {
            $security = $cookie_setting ['security'];
        }
        if ($expire != 0) {
            $expire = time() + $expire;
        }
        @setcookie($name, $value, $expire, $path, $domain, $security);
    }
312869
public static NewCookie newDeletedCookie(String name) {
        /**
         * Create a new instance.
         *
         * @param name     the name of the cookie
         * @param value    the value of the cookie
         * @param path     the URI path for which the cookie is valid
         * @param domain   the host domain for which the cookie is valid
         * @param version  the version of the specification to which the cookie complies
         * @param comment  the comment
         * @param maxAge   the maximum age of the cookie in seconds
         * @param expiry   the cookie expiry date.
         * @param secure   specifies whether the cookie will only be sent over a secure connection
         * @param httpOnly if {@code true} make the cookie HTTP only, i.e. only visible as part of an HTTP request.
         * @throws IllegalArgumentException if name is {@code null}.
         * @since 2.0
         */
        return new NewCookie(name, DELETED_COOKIE_VALUE, "/", null, Cookie.DEFAULT_VERSION, null, 0, null, false, true);
    }
1305477
public static Builder cookie(String name, String value) {
        return builder(name, value)
                // Populate default:
                .setPath("/").setHttpOnly(true).setSecure(false).setMaxAge(3600);
    }
1073040
public void sendPermanentCookie(String name, String value) {
        context.addCookie(Cookie.builder(name, value).setMaxAge(Cookie.ONE_YEAR * 20).build());
    }
588120
public void set(AsciiString name, String value){
        if(name==null)
            return;
        if(value==null){
            remove(name);
            return;
        }
        Header head = entry(name, true);
        if(head.value==null)
            head.value = value;
        else{
            head.value = value;
            Header next = head.sameNext;
            head.sameNext = null;
            head.samePrev = head;
            removeSameNext(next);
        }
        assert validateLinks();
    }
46068
public final static void addCookie(String name, String value, int maxAgeInSeconds, String path, String domain) {
		ServletUtil.addCookie(getServletResponse(), name, value, maxAgeInSeconds, path, domain);
	}
468423
public void sendPermanentCookie(String name, String value) {
        Cookie cookie = new Cookie(name, value);
        cookie.setMaxAge(60*60*24*365*20);
        RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(cookie));
    }
1093515
public String cookie(String name) {
        Cookie[] cookies = servletRequest.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                if (cookie.getName().equals(name)) {
                    return cookie.getValue();
                }
            }
        }
        return null;
    }
269894
public Response removeCookie(String name) {
        Cookie cookie = new Cookie(name, "");
        cookie.setSecure(true);
        cookie.setMaxAge(0);
        addCookie(cookie);

        return this;
    }
741335
@Nonnull
  public static EChange removeCookie (@Nullable final String sName)
  {
    if (StringHelper.hasNoText (sName))
      return EChange.UNCHANGED;

    return s_aRWLock.writeLocked ( () -> s_aCookies.removeObject (sName));
  }
200460
public static void setCookie(HttpServletResponse response, String name,
                                 String value, String domain, int maxAge) {
        if (value == null) {
            value = "";
        }
        Cookie cookie = new Cookie(name, value);
        cookie.setMaxAge(maxAge);
        if (domain != null && !"".equals(domain)) {
            cookie.setDomain(domain);
        }
        cookie.setPath("/");
        response.addCookie(cookie);
    }
336193
public CrawlerPack addCookie(String name, String value){
        if( null == name ) {
            log.warn("addCookie: Cookie name null.");
            return this;
        }

        cookies.add( new Cookie("", name, value) );

        return this;
    }
290158
function (name) {
    var updateCookieVals = "";
    var cookieVals = $.cookie(this.cookieName).split("|");
    var k = 0;
    for (var i = 0; i < cookieVals.length; i++) {
      var fieldVals = cookieVals[i].split("~");
      if (fieldVals[0] != name) {
        updateCookieVals += (k === 0) ? fieldVals[0]+"~"+fieldVals[1] : "|"+fieldVals[0]+"~"+fieldVals[1];
        k++;
      }
    }
    $.cookie(this.cookieName,updateCookieVals);
  }