| java.lang.Object net.matuschek.http.cookie.Cookie
Cookie | public class Cookie (Code) | | This object represents an HTTP cookie for a browser.
It can interpret both Netscape and RFC cookies
author: Daniel Matuschek version: $Id $ |
Constructor Summary | |
public | Cookie() | public | Cookie(String setCookie, URL u) Constructor that initializes a cookie from a HTTP Set-Cookie: header
Parameters: setCookie - a HTTP Set-Cookie: header line (including Set-Cookie) Parameters: u - there URL of the HTTP document where this cookie was set fromthis is needed, if no "domain" field is given in the cookie. | public | Cookie(String name, String value, String domain, String path) Initializes a cookie from an name-value pair and additional
information. |
HEADER_COOKIE | final static String HEADER_COOKIE(Code) | | HTTP cookie response header (not case sensitive)
|
HEADER_SETCOOKIE | final static String HEADER_SETCOOKIE(Code) | | HTTP Set-Cookie response header (not case sensitive)
|
Cookie | public Cookie()(Code) | | Default constructor, creates an empty cookie
|
Cookie | public Cookie(String setCookie, URL u) throws CookieException(Code) | | Constructor that initializes a cookie from a HTTP Set-Cookie: header
Parameters: setCookie - a HTTP Set-Cookie: header line (including Set-Cookie) Parameters: u - there URL of the HTTP document where this cookie was set fromthis is needed, if no "domain" field is given in the cookie. It will be ignored otherwise exception: CookieException - if the given setCookie String is not a validHTTP Set-Cookie response header |
Cookie | public Cookie(String name, String value, String domain, String path)(Code) | | Initializes a cookie from an name-value pair and additional
information. This constructor is useful to create cookies
by yourself.
|
getNameValuePair | public String getNameValuePair()(Code) | | Gets the cookie name and value as NAME=VALUE pair
a string in the format NAME=VALUE |
isSecure | public boolean isSecure()(Code) | | |
isValid | public boolean isValid()(Code) | | Is this cookie valid ?
true if the cookie is valid, false if it is expired |
isValid | public boolean isValid(URL u)(Code) | | Is this cookie valid for the given URL ?
That means, it is not expired and host and path matches the given URL
true if this cookie is valid for the given URL, false otherwise |
overwrites | public boolean overwrites(Cookie c)(Code) | | Does this Cookie overwrite another cookie ?
A Cookie overwrites another one, if they have the same
name, domain and path. It doesn't matter, if expireDate or value of
the cookie are different !
|
toString | public String toString()(Code) | | Convert the cookie to a String. Format is not defined and may change
without notice. Use it for debugging and logging purposes only !
a String representation of this cookie |
|
|