final class Cookie
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ExtendedTime |
creationTime |
private java.lang.String |
domain |
private long |
expiryTime |
private boolean |
hostOnly |
private boolean |
httpOnly |
private static java.util.regex.Pattern |
IP_ADDRESS_PATTERN |
private long |
lastAccessTime |
private static java.util.logging.Logger |
logger |
private java.lang.String |
name |
private java.lang.String |
path |
private boolean |
persistent |
private boolean |
secureOnly |
private java.lang.String |
value |
Modifier | Constructor and Description |
---|---|
private |
Cookie(java.lang.String name,
java.lang.String value,
long expiryTime,
java.lang.String domain,
java.lang.String path,
ExtendedTime creationTime,
long lastAccessTime,
boolean persistent,
boolean hostOnly,
boolean secureOnly,
boolean httpOnly)
Creates a new
Cookie . |
Modifier and Type | Method and Description |
---|---|
(package private) static java.lang.String |
defaultPath(java.net.URI uri)
Computes the default path for a given URI.
|
(package private) static boolean |
domainMatches(java.lang.String domain,
java.lang.String cookieDomain)
Determines if a domain matches another domain.
|
private static boolean |
equal(java.lang.Object obj1,
java.lang.Object obj2)
Determines, in null-safe manner, if two objects are equal.
|
boolean |
equals(java.lang.Object obj) |
(package private) ExtendedTime |
getCreationTime()
Returns the creation time of this cookie.
|
(package private) java.lang.String |
getDomain()
Returns the domain of this cookie.
|
(package private) long |
getExpiryTime()
Returns the expiry time of this cookie.
|
(package private) boolean |
getHostOnly()
Returns the host-only property of this cookie.
|
(package private) boolean |
getHttpOnly()
Returns the http-only property of this cookie.
|
(package private) long |
getLastAccessTime()
Returns the last access time of this cookie.
|
(package private) java.lang.String |
getName()
Returns the name of this cookie.
|
(package private) java.lang.String |
getPath()
Returns the path of this cookie.
|
(package private) boolean |
getPersistent()
Returns the persistent property of this cookie.
|
(package private) boolean |
getSecureOnly()
Returns the secure-only property of this cookie.
|
(package private) java.lang.String |
getValue()
Returns the value of this cookie.
|
(package private) boolean |
hasExpired()
Determines if this cookie has expired.
|
int |
hashCode() |
private static int |
hashCode(java.lang.Object obj)
Computes the hash code of an object in null safe-manner.
|
private static boolean |
isIpAddress(java.lang.String hostname)
Determines if a hostname is an IP address.
|
(package private) static Cookie |
parse(java.lang.String setCookieString,
ExtendedTime currentTime)
Parses a
Set-Cookie header string into a Cookie
object. |
private static java.lang.String |
parseDomain(java.lang.String attributeValue)
Parses the value of the
Domain attribute. |
private static long |
parseExpires(java.lang.String attributeValue)
Parses the value of the
Expires attribute. |
private static long |
parseMaxAge(java.lang.String attributeValue,
long currentTime)
Parses the value of the
Max-Age attribute. |
private static java.lang.String |
parsePath(java.lang.String attributeValue)
Parses the value of the
Path attribute. |
(package private) static boolean |
pathMatches(java.lang.String path,
java.lang.String cookiePath)
Determines if a path matches another path.
|
(package private) void |
setCreationTime(ExtendedTime creationTime)
Sets the creation time of this cookie.
|
(package private) void |
setDomain(java.lang.String domain)
Sets the domain of this cookie.
|
(package private) void |
setHostOnly(boolean hostOnly)
Sets the host-only property of this cookie.
|
(package private) void |
setLastAccessTime(long lastAccessTime)
Sets the last access time of this cookie.
|
(package private) void |
setPath(java.lang.String path)
Sets the path of this cookie.
|
java.lang.String |
toString() |
private static final java.util.logging.Logger logger
private static final java.util.regex.Pattern IP_ADDRESS_PATTERN
private final java.lang.String name
private final java.lang.String value
private final long expiryTime
private java.lang.String domain
private java.lang.String path
private ExtendedTime creationTime
private long lastAccessTime
private final boolean persistent
private boolean hostOnly
private final boolean secureOnly
private final boolean httpOnly
private Cookie(java.lang.String name, java.lang.String value, long expiryTime, java.lang.String domain, java.lang.String path, ExtendedTime creationTime, long lastAccessTime, boolean persistent, boolean hostOnly, boolean secureOnly, boolean httpOnly)
Cookie
.static Cookie parse(java.lang.String setCookieString, ExtendedTime currentTime)
Set-Cookie
header string into a Cookie
object.private static long parseExpires(java.lang.String attributeValue) throws java.text.ParseException
Expires
attribute.java.text.ParseException
private static long parseMaxAge(java.lang.String attributeValue, long currentTime) throws java.text.ParseException
Max-Age
attribute.java.text.ParseException
private static java.lang.String parseDomain(java.lang.String attributeValue) throws java.text.ParseException
Domain
attribute.java.text.ParseException
private static java.lang.String parsePath(java.lang.String attributeValue)
Path
attribute.java.lang.String getName()
java.lang.String getValue()
long getExpiryTime()
java.lang.String getDomain()
void setDomain(java.lang.String domain)
java.lang.String getPath()
void setPath(java.lang.String path)
ExtendedTime getCreationTime()
void setCreationTime(ExtendedTime creationTime)
long getLastAccessTime()
void setLastAccessTime(long lastAccessTime)
boolean getPersistent()
boolean getHostOnly()
void setHostOnly(boolean hostOnly)
boolean getSecureOnly()
boolean getHttpOnly()
boolean hasExpired()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
private static boolean equal(java.lang.Object obj1, java.lang.Object obj2)
public int hashCode()
hashCode
in class java.lang.Object
private static int hashCode(java.lang.Object obj)
public java.lang.String toString()
toString
in class java.lang.Object
static boolean domainMatches(java.lang.String domain, java.lang.String cookieDomain)
private static boolean isIpAddress(java.lang.String hostname)
static java.lang.String defaultPath(java.net.URI uri)
static boolean pathMatches(java.lang.String path, java.lang.String cookiePath)