/** * Set a new cookie * * @param name Cookie name * @param value Cookie value * @param maxAge Cookie duration (-1 for a transient cookie and 0 for a cookie that expires now) * @param path Cookie path * @param domain Cookie domain */ public void setCookie(String name, String value, int maxAge, String path, String domain) { setCookie(name, value, maxAge, path, domain, false, false); }
/** * Set a new cookie with path “/” * * @param name Cookie name * @param value Cookie value * @param maxAge Cookie duration (-1 for a transient cookie and 0 for a cookie that expires now) */ public void setCookie(String name, String value, int maxAge) { setCookie(name, value, maxAge, "/"); }
/** * Set a new cookie * * @param name Cookie name * @param value Cookie value * @param maxAge Cookie duration (-1 for a transient cookie and 0 for a cookie that expires now) * @param path Cookie path */ public void setCookie(String name, String value, int maxAge, String path) { setCookie(name, value, maxAge, path, null); }
/** * Set a new transient cookie with path “/”<br> * For example: * * <pre> * response().setCookie("theme", "blue"); * </pre> * * @param name Cookie name * @param value Cookie value */ public void setCookie(String name, String value) { setCookie(name, value, -1); }