public static class H.Cookie extends Object implements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
H.Cookie.F
The function object namespace
|
| Constructor and Description |
|---|
Cookie(String name) |
Cookie(String name,
String value) |
Cookie(String name,
String value,
int maxAge,
boolean secure,
String path,
String domain,
boolean httpOnly) |
| Modifier and Type | Method and Description |
|---|---|
static Collection<H.Cookie> |
all()
Returns all cookies from current context
|
String |
comment() |
H.Cookie |
comment(String comment) |
String |
domain()
Returns the domain of the cookie
|
H.Cookie |
domain(String domain)
Set the domain of the cookie
|
Date |
expires() |
H.Cookie |
expires(Date expires) |
static H.Cookie |
get(String name)
Get a cookie from current context by name
|
boolean |
httpOnly() |
H.Cookie |
httpOnly(boolean httpOnly) |
int |
maxAge()
Returns the maximum age of cookie specified in seconds.
|
H.Cookie |
maxAge(int maxAge)
Set the max age of the cookie in seconds.
|
String |
name()
Returns the name of the cookie.
|
String |
path()
Returns the path on the server
to which the browser returns this cookie.
|
H.Cookie |
path(String uri)
Specifies a path for the cookie
to which the client should return the cookie.
|
boolean |
secure()
Returns
true if the browser is sending cookies
only over a secure protocol, or false if the
browser can send cookies using any protocol. |
H.Cookie |
secure(boolean secure)
Indicates to the browser whether the cookie should only be sent
using a secure protocol, such as HTTPS or SSL.
|
static void |
set(H.Cookie cookie)
Add a cookie to the current context
|
String |
value()
Returns the value of the cookie
|
H.Cookie |
value(String value)
Set a value to a cookie and the return
this cookie |
int |
version()
Returns the version of the protocol this cookie complies
with.
|
H.Cookie |
version(int v)
Sets the version of the cookie protocol that this Cookie complies
with.
|
public Cookie(String name)
public String name()
public String value()
public H.Cookie value(String value)
this cookievalue - the value to be set to the cookiepublic String domain()
public H.Cookie domain(String domain)
domain - the domain stringpublic String path()
path(String)public H.Cookie path(String uri)
The cookie is visible to all the pages in the directory you specify, and all the pages in that directory's subdirectories.
Consult RFC 2109 (available on the Internet) for more information on setting path names for cookies.
uri - a String specifying a pathpathpublic int maxAge()
-1 then the cookie will persist until
browser shutdownpublic H.Cookie maxAge(int maxAge)
A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age.
A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.
maxAge - the max age to be setmaxAge()public Date expires()
public boolean secure()
true if the browser is sending cookies
only over a secure protocol, or false if the
browser can send cookies using any protocol.secure(boolean)public H.Cookie secure(boolean secure)
The default value is false.
secure - the cookie secure requirementpublic int version()
version(int)public H.Cookie version(int v)
Version 0 complies with the original Netscape cookie specification. Version 1 complies with RFC 2109.
Since RFC 2109 is still somewhat new, consider version 1 as experimental; do not use it yet on production sites.
v - 0 if the cookie should comply with the original Netscape
specification; 1 if the cookie should comply with RFC 2109version()public boolean httpOnly()
public H.Cookie httpOnly(boolean httpOnly)
public String comment()
public static void set(H.Cookie cookie)
cookie - the cookiepublic static H.Cookie get(String name)
name - the cookie namepublic static Collection<H.Cookie> all()
Copyright © 2017. All Rights Reserved.