| Constructor and Description |
|---|
BeanCookie(String name) |
| Modifier and Type | Method and Description |
|---|---|
String |
getDomain()
This returns the domain for this cookie.
|
int |
getExpiry()
This returns the number of seconds a cookie lives for.
|
String |
getName()
This returns the name for this cookie.
|
String |
getPath()
This returns the path for this cookie.
|
boolean |
getSecure()
This determines whether the cookie is secure.
|
String |
getValue()
This returns the value for this cookie.
|
int |
getVersion()
This returns the version for this cookie.
|
boolean |
isHttpOnly() |
boolean |
isSecure() |
void |
setDomain(String domain)
This enables the domain for this
Cookie to be
set. |
void |
setExpiry(int expiry)
This allows a lifetime to be specified for the cookie.
|
void |
setHttpOnly(boolean httpOnly) |
void |
setPath(String path)
This is used to set the cookie path for this cookie.
|
void |
setSecure(boolean secure)
This is used to determine if the client browser should send
this cookie over a secure protocol.
|
void |
setValue(String value)
This enables the value of the cookie to be changed.
|
void |
setVersion(int version)
This enables the version of the
Cookie to be
set. |
static String |
toHeader(Cookie c)
Formats the cookie in a suitable format for a SetCookie response
|
static String |
toHeader(Cookie c,
long nowMs) |
public BeanCookie(String name)
public static String toHeader(Cookie c)
public int getVersion()
CookiegetVersion in interface Cookiepublic void setVersion(int version)
CookieCookie to be
set. By default the version of the Cookie is
set to 1. It is not advisable to set the version higher
than 1, unless it is known that the client will accept it.
Some old browsers can only handle cookie version 0. This can be used to comply with the original Netscape cookie specification. Version 1 complies with RFC 2109.
setVersion in interface Cookieversion - this is the version number for the cookiepublic String getName()
CookieCookie
is for, these values will always be present. These are
mandatory for both the Cookie and Set-Cookie headers.
Because the cookie may be stored by name, the cookie name cannot be modified after the creation of the cookie object.
public String getValue()
CookieCookie
is for, these values will always be present. These are
mandatory for both the Cookie and Set-Cookie headers.public void setValue(String value)
Cookiesome value
is perfectly legal. However for maximum compatibility
across the different plaforms such as PHP, JavaScript and
others, quotations should be avoided. If quotations are
required they must be added to the string. For example a
quoted value could be created as "some value".public boolean isSecure()
public boolean getSecure()
Cookiepublic void setSecure(boolean secure)
Cookiepublic int getExpiry()
Cookiepublic void setExpiry(int expiry)
Cookiepublic String getDomain()
CookietoString or toClientString is
invoked the domain will not be present if this is null.public void setDomain(String domain)
CookieCookie to be
set. The form of the domain is specified by RFC 2109. The
value can begin with a dot, like .host.com.
This means that the cookie is visible within a specific
DNS zone like www.host.com. By default this
value is null which means it is sent back to its origin.public String getPath()
CookietoString
or toClientString is invoked the path will
not be present if the path attribute is null.public void setPath(String path)
Cookie/pub/bin, then requests for the
resource http://hostname:port/pub/bin/README
will be issued with this cookie. The cookie is issued for
all resources in the path and all subdirectories.public void setHttpOnly(boolean httpOnly)
setHttpOnly in interface Cookiepublic boolean isHttpOnly()
isHttpOnly in interface Cookie