com.meterware.httpunit.cookies
public class CookieJar extends Object
Constructor Summary | |
---|---|
CookieJar()
Creates an empty cookie jar. | |
CookieJar(CookieSource source)
Creates a cookie jar which is initially populated with cookies parsed from the Set-Cookie and
Set-Cookie2 header fields.
|
Method Summary | |
---|---|
void | addCookie(String name, String value)
Defines a cookie to be sent to the server on every request. |
void | clear()
Empties this cookie jar of all contents. |
Cookie | getCookie(String name)
Returns the value of the specified cookie.
|
String | getCookieHeaderField(URL targetURL)
Returns the value of the cookie header to be sent to the specified URL.
|
String[] | getCookieNames()
Returns the name of all the active cookies in this cookie jar.
|
Collection | getCookies()
Returns a collection containing all of the cookies in this jar. |
String | getCookieValue(String name)
Returns the value of the specified cookie.
|
void | putCookie(String name, String value)
Defines a cookie to be sent to the server on every request. |
void | updateCookies(CookieJar newJar)
Updates the cookies maintained in this cookie jar with those in another cookie jar. |
Set-Cookie
and
Set-Cookie2
header fields.
Note that the parsing does not strictly follow the specifications, but attempts to imitate the behavior of popular browsers. Specifically, it allows cookie values to contain commas, which the Netscape standard does not allow for, but which is required by some servers.
Deprecated: as of 1.6, use #putCookie
Defines a cookie to be sent to the server on every request. This bypasses the normal mechanism by which only certain cookies are sent based on their host and path.Since: 1.6