Package org.apache.http.impl.cookie
Class RFC2965DomainAttributeHandler
- java.lang.Object
-
- org.apache.http.impl.cookie.RFC2965DomainAttributeHandler
-
- All Implemented Interfaces:
CommonCookieAttributeHandler
,CookieAttributeHandler
@Contract(threading=IMMUTABLE) public class RFC2965DomainAttributeHandler extends java.lang.Object implements CommonCookieAttributeHandler
"Domain"
cookie attribute handler for RFC 2965 cookie spec.- Since:
- 3.1
-
-
Constructor Summary
Constructors Constructor Description RFC2965DomainAttributeHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
domainMatch(java.lang.String host, java.lang.String domain)
Performs domain-match as defined by the RFC2965.java.lang.String
getAttributeName()
boolean
match(Cookie cookie, CookieOrigin origin)
Match cookie domain attribute.void
parse(SetCookie cookie, java.lang.String domain)
Parse cookie domain attribute.void
validate(Cookie cookie, CookieOrigin origin)
Validate cookie domain attribute.
-
-
-
Method Detail
-
parse
public void parse(SetCookie cookie, java.lang.String domain) throws MalformedCookieException
Parse cookie domain attribute.- Specified by:
parse
in interfaceCookieAttributeHandler
- Parameters:
cookie
-Cookie
to be updateddomain
- cookie attribute value from the cookie response header- Throws:
MalformedCookieException
-
domainMatch
public boolean domainMatch(java.lang.String host, java.lang.String domain)
Performs domain-match as defined by the RFC2965.Host A's name domain-matches host B's if
- their host name strings string-compare equal; or
- A is a HDN string and has the form NB, where N is a non-empty name string, B has the form .B', and B' is a HDN string. (So, x.y.com domain-matches .Y.com but not Y.com.)
- Parameters:
host
- host name where cookie is received from or being sent to.domain
- The cookie domain attribute.- Returns:
- true if the specified host matches the given domain.
-
validate
public void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException
Validate cookie domain attribute.- Specified by:
validate
in interfaceCookieAttributeHandler
- Parameters:
cookie
-Cookie
to validateorigin
- the cookie source to validate against- Throws:
MalformedCookieException
- if cookie validation fails for this attribute
-
match
public boolean match(Cookie cookie, CookieOrigin origin)
Match cookie domain attribute.- Specified by:
match
in interfaceCookieAttributeHandler
- Parameters:
cookie
-Cookie
to matchorigin
- the cookie source to match against- Returns:
true
if the match is successful;false
otherwise
-
getAttributeName
public java.lang.String getAttributeName()
- Specified by:
getAttributeName
in interfaceCommonCookieAttributeHandler
-
-