org.apache.commons.httpclient.cookie
public class Cookie2 extends Cookie
Cookie class for RFC2965Spec cookie specification. It extends Cookie class and adds newer cookie attributes and functions required for this specification.
Since: 3.1
Field Summary | |
---|---|
static String | COMMENT |
static String | COMMENTURL |
static String | DISCARD |
static String | DOMAIN |
static String | MAXAGE |
static String | PATH |
static String | PORT |
static String | SECURE |
static String | VERSION |
Constructor Summary | |
---|---|
Cookie2()
Default constructor. | |
Cookie2(String domain, String name, String value)
Creates a cookie with the given name, value and domain attribute.
| |
Cookie2(String domain, String name, String value, String path, Date expires, boolean secure)
Creates a cookie with the given name, value, domain attribute,
path attribute, expiration attribute, and secure attribute
| |
Cookie2(String domain, String name, String value, String path, Date expires, boolean secure, int[] ports)
Creates a cookie with the given name, value, domain attribute,
path attribute, expiration attribute, secure attribute, and ports
attribute.
|
Method Summary | |
---|---|
String | getCommentURL()
If a user agent (web browser) presents this cookie to a user, the
cookie's purpose will be described by the information at this URL.
|
int[] | getPorts()
Get the Port attribute. |
boolean | isPersistent()
Returns false if the cookie should be discarded at the end
of the "session"; true otherwise.
|
boolean | isPortAttributeBlank() |
boolean | isPortAttributeSpecified() |
boolean | isVersionAttributeSpecified() |
void | setCommentURL(String commentURL)
If a user agent (web browser) presents this cookie to a user, the
cookie's purpose will be described by the information at this URL.
|
void | setDiscard(boolean toDiscard)
Set the Discard attribute.
|
void | setPortAttributeBlank(boolean value)
Indicates whether the Port attribute in Set-Cookie2 header
contains no value (is of the form Port="").
|
void | setPortAttributeSpecified(boolean value)
Indicates whether the cookie had a port attribute specified in the
Set-Cookie2 response header.
|
void | setPorts(int[] ports)
Set the Port attribute. |
void | setVersionAttributeSpecified(boolean value)
Indicates whether the cookie had a version attribute specified in the
Set-Cookie2 response header.
|
String | toExternalForm()
Return a textual representation of the cookie.
|
Parameters: name the cookie name value the cookie value domain the domain this cookie can be sent to
Parameters: name the cookie name value the cookie value domain the domain this cookie can be sent to path the path prefix for which this cookie can be sent expires the Date at which this cookie expires, or null if the cookie expires at the end of the session secure if true this cookie can only be sent over secure connections
Throws: IllegalArgumentException If cookie name is null or blank, cookie name contains a blank, or cookie name starts with character $
Parameters: name the cookie name value the cookie value domain the domain this cookie can be sent to path the path prefix for which this cookie can be sent expires the Date at which this cookie expires, or null if the cookie expires at the end of the session secure if true this cookie can only be sent over secure connections ports the ports for which this cookie can be sent
Throws: IllegalArgumentException If cookie name is null or blank, cookie name contains a blank, or cookie name starts with character $
See Also: setCommentURL
See Also: (int[])
Returns: false if the cookie should be discarded at the end of the "session"; true otherwise
Returns: true if the port attribute in Set-Cookie2 header had no value (was of the form Port="").
See Also: Cookie2
Returns: true if cookie port attribute was specified in the Set-Cookie2 header.
See Also: Cookie2
Returns: true if cookie version attribute was specified in the Set-Cookie2 header.
See Also: Cookie2
Parameters: commentURL
See Also: getCommentURL
See Also: isPersistent
This value is required for generating the Cookie request header because the specification requires that if Set-Cookie2 header contains a blank value for port attribute, the Cookie header should also contain a port attribute with no value.
Parameters: value true if port attribute is specified as blank in response header.
See Also: isPortAttributeBlank
Parameters: value true if port attribute is specified in response header.
See Also: Cookie2
Parameters: ports
See Also: getPorts
Parameters: value true if version attribute is specified in response header.
See Also: isVersionAttributeSpecified
Returns: string.