public final class CmisHttpCookie extends Object implements Cloneable, Serializable
Constructor and Description |
---|
CmisHttpCookie(String name,
String value)
Initializes a cookie with the specified name and value.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Answers a copy of this object.
|
static boolean |
domainMatches(String domain,
String host)
A utility method used to check whether the host name is in a domain or
not.
|
boolean |
equals(Object obj)
Answers whether two cookies are equal.
|
String |
getComment()
Answers the value of comment attribute(specified in RFC 2965) of this
cookie.
|
String |
getCommentURL()
Answers the value of commentURL attribute(specified in RFC 2965) of this
cookie.
|
boolean |
getDiscard()
Answers the value of discard attribute(specified in RFC 2965) of this
cookie.
|
String |
getDomain()
Answers the domain name for this cookie in the format specified in RFC
2965
|
long |
getMaxAge()
Returns the Max-Age value as specified in RFC 2965 of this cookie.
|
String |
getName()
Answers the name for this cookie.
|
String |
getPath()
Answers the path part of a request URL to which this cookie is returned.
|
String |
getPortlist()
Answers the value of port attribute(specified in RFC 2965) of this
cookie.
|
boolean |
getSecure()
Answers true if the browser only sends cookies over a secure protocol.
|
String |
getValue()
Answers the value of this cookie.
|
int |
getVersion()
Get the version of this cookie
|
boolean |
hasExpired()
Answers whether the cookie has expired.
|
int |
hashCode()
Answers hash code of this http cookie.
|
static List<CmisHttpCookie> |
parse(String header)
Constructs a cookie from a string.
|
void |
setComment(String purpose)
Set the value of comment attribute(specified in RFC 2965) of this cookie.
|
void |
setCommentURL(String purpose)
Set the value of commentURL attribute(specified in RFC 2965) of this
cookie.
|
void |
setDiscard(boolean discard)
Set the value of discard attribute(specified in RFC 2965) of this cookie.
|
void |
setDomain(String pattern)
Set the domain value for this cookie.
|
void |
setMaxAge(long expiry)
Sets the Max-Age value as specified in RFC 2965 of this cookie to expire.
|
void |
setPath(String path)
Set the path to which this cookie is returned.
|
void |
setPortlist(String ports)
Set the value of port attribute(specified in RFC 2965) of this cookie.
|
void |
setSecure(boolean flag)
Tells the browser whether the cookies should be sent to server through
secure protocols.
|
void |
setValue(String newValue)
Sets the value for this cookie after it has been instantiated.
|
void |
setVersion(int v)
Sets the version of the cookie.
|
String |
toString()
Returns a string to represent the cookie.
|
public CmisHttpCookie(String name, String value)
name
- - the specific name of the cookievalue
- - the specific value of the cookieIllegalArgumentException
- - if the name contains not-allowed or reserved charactersNullPointerException
- if the value of name is nullpublic static boolean domainMatches(String domain, String host)
domain
- the domain to be checked againsthost
- the host to be checkedpublic static List<CmisHttpCookie> parse(String header)
header
- a set-cookie or set-cookie2 header.IllegalArgumentException
- if the string does not comply with cookie specification, or
the cookie name contains illegal characters, or reserved
tokens of cookie specification appearsNullPointerException
- if header is nullpublic Object clone()
public boolean equals(Object obj)
public String getComment()
public String getCommentURL()
public boolean getDiscard()
public String getDomain()
public long getMaxAge()
public String getName()
public String getPath()
public String getPortlist()
public boolean getSecure()
public String getValue()
public int getVersion()
public boolean hasExpired()
public int hashCode()
public void setComment(String purpose)
purpose
- the comment value to be setpublic void setCommentURL(String purpose)
purpose
- the value of commentURL attribute to be setpublic void setDiscard(boolean discard)
discard
- the value for discard attributepublic void setDomain(String pattern)
pattern
- the domain patternpublic void setMaxAge(long expiry)
expiry
- the value used to set the Max-Age value of this cookiepublic void setPath(String path)
path
- the path to which this cookie is returnedpublic void setPortlist(String ports)
ports
- the value for port attributepublic void setSecure(boolean flag)
flag
- tells browser to send cookie to server only through secure
protocol if flag is truepublic void setValue(String newValue)
newValue
- the value for this cookiepublic void setVersion(int v)
v
- 0 or 1 as stated aboveIllegalArgumentException
- if v is neither 0 nor 1Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.