public class Cookies extends Object
RFC 6265: The origin domain of a cookie is the domain of the originating request. If the origin domain is an IP, the cookie's domain attribute must not be set. If a cookie's domain attribute is not set, the cookie is only applicable to its origin domain. If a cookie's domain attribute is set, -- the cookie is applicable to that domain and all its subdomains; -- the cookie's domain must be the same as, or a parent of, the origin domain -- the cookie's domain must not be a TLD, a public suffix, or a parent of a public suffix.
| 构造器和说明 |
|---|
Cookies() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
calculatePath(String uri)
Get cookie default path from url path
|
static boolean |
isDomainSuffix(String domain,
String domainSuffix)
If domainSuffix is suffix of domain
|
static boolean |
isIP(String host)
A simple, non-accurate method(we just need to distinguish ip and domain) to judge if host is a ipv4/ipv6 address.
|
static boolean |
match(Cookie cookie,
String protocol,
String host,
String path)
If cookie match the given scheme, host, and path.
|
static @Nullable Cookie |
parseCookie(String cookieStr,
String host,
String defaultPath)
Parse one cookie header value, return the cookie.
|
public static boolean isIP(String host)
public static boolean isDomainSuffix(String domain, String domainSuffix)
domain - start with "."domainSuffix - not start with "."public static boolean match(Cookie cookie, String protocol, String host, String path)
host - should be lower caseCopyright © 2019. All rights reserved.