public class Cookie extends Object implements Serializable
Some notes about how Netscape (4.7) parses:
Modifier and Type | Field and Description |
---|---|
protected String |
domain |
protected Date |
expires |
protected String |
name |
protected String |
path |
protected boolean |
secure |
protected String |
value |
Modifier | Constructor and Description |
---|---|
protected |
Cookie(RoRequest req)
Use
parse() to create cookies. |
|
Cookie(String name,
String value,
String domain,
String path,
Date expires,
boolean secure)
Create a cookie.
|
Modifier and Type | Method and Description |
---|---|
boolean |
discard() |
boolean |
equals(Object obj)
Two cookies match if the name, path and domain match.
|
Date |
expires() |
String |
getDomain()
Return the domain this cookie is valid in.
|
String |
getName()
Return the name of this cookie.
|
String |
getPath()
Return the path this cookie is associated with.
|
String |
getValue()
Return the value of this cookie.
|
boolean |
hasExpired() |
int |
hashCode()
Hash up name, path and domain into new hash.
|
boolean |
isSecure()
Return whether this cookie should only be sent over secure connections.
|
protected static Cookie[] |
parse(String set_cookie,
RoRequest req)
Parses the Set-Cookie header into an array of Cookies.
|
protected boolean |
sendWith(RoRequest req) |
protected String |
toExternalForm() |
String |
toString()
Create a string containing all the cookie fields.
|
protected String name
protected String value
protected Date expires
protected String domain
protected String path
protected boolean secure
public Cookie(String name, String value, String domain, String path, Date expires, boolean secure)
name
- the cookie namevalue
- the cookie valuedomain
- the host this cookie will be sent topath
- the path prefix for which this cookie will be sentepxires
- the Date this cookie expires, null if at end of
sessionsecure
- if true this cookie will only be over secure connectionsNullPointerException
- if name, value,
domain, or path
is nullprotected Cookie(RoRequest req)
parse()
to create cookies.protected static Cookie[] parse(String set_cookie, RoRequest req) throws ProtocolException
set_cookie
- the Set-Cookie header received from the serverreq
- the request usedProtocolException
- if an error occurs during parsingpublic String getName()
public String getValue()
public Date expires()
public boolean discard()
public String getDomain()
public String getPath()
public boolean isSecure()
public boolean hasExpired()
protected boolean sendWith(RoRequest req)
req
- the request to be sentpublic int hashCode()
public boolean equals(Object obj)
protected String toExternalForm()
Copyright © 2000-2014. All Rights Reserved.