Class RFC2109Spec
- java.lang.Object
-
- org.apache.commons.httpclient.cookie.CookieSpecBase
-
- org.apache.commons.httpclient.cookie.RFC2109Spec
-
- All Implemented Interfaces:
CookieSpec
public class RFC2109Spec extends CookieSpecBase
RFC 2109 specific cookie management functions
- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSET_COOKIE_KEYCookie Response Header name for cookies processed by this spec.-
Fields inherited from interface org.apache.commons.httpclient.cookie.CookieSpec
PATH_DELIM, PATH_DELIM_CHAR
-
-
Constructor Summary
Constructors Constructor Description RFC2109Spec()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandomainMatch(java.lang.String host, java.lang.String domain)Performs domain-match as defined by the RFC2109.java.lang.StringformatCookie(Cookie cookie)Return a string suitable for sending in a "Cookie" header as defined in RFC 2109java.lang.StringformatCookies(Cookie[] cookies)Create a RFC 2109 compliant "Cookie" header value containing allCookies in cookies suitable for sending in a "Cookie" headervoidparseAttribute(NameValuePair attribute, Cookie cookie)Parse RFC 2109 specific cookie attribute and update the corresponsingCookieproperties.voidvalidate(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie cookie)Performs RFC 2109 compliantCookievalidation-
Methods inherited from class org.apache.commons.httpclient.cookie.CookieSpecBase
formatCookieHeader, formatCookieHeader, getValidDateFormats, match, match, parse, parse, pathMatch, setValidDateFormats
-
-
-
-
Field Detail
-
SET_COOKIE_KEY
public static final java.lang.String SET_COOKIE_KEY
Cookie Response Header name for cookies processed by this spec.- See Also:
- Constant Field Values
-
-
Method Detail
-
parseAttribute
public void parseAttribute(NameValuePair attribute, Cookie cookie) throws MalformedCookieException
Parse RFC 2109 specific cookie attribute and update the corresponsingCookieproperties.- Specified by:
parseAttributein interfaceCookieSpec- Overrides:
parseAttributein classCookieSpecBase- Parameters:
attribute-NameValuePaircookie attribute from the Set- Cookiecookie-Cookieto be updated- Throws:
MalformedCookieException- if an exception occurs during parsing
-
validate
public void validate(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie cookie) throws MalformedCookieExceptionPerforms RFC 2109 compliantCookievalidation- Specified by:
validatein interfaceCookieSpec- Overrides:
validatein classCookieSpecBase- Parameters:
host- the host from which theCookiewas receivedport- the port from which theCookiewas receivedpath- the path from which theCookiewas receivedsecure- true when theCookiewas received using a secure connectioncookie- The cookie to validate- Throws:
MalformedCookieException- if an exception occurs during validation
-
domainMatch
public boolean domainMatch(java.lang.String host, java.lang.String domain)Performs domain-match as defined by the RFC2109.- Specified by:
domainMatchin interfaceCookieSpec- Overrides:
domainMatchin classCookieSpecBase- Parameters:
host- The target host.domain- The cookie domain attribute.- Returns:
- true if the specified host matches the given domain.
- Since:
- 3.0
-
formatCookie
public java.lang.String formatCookie(Cookie cookie)
Return a string suitable for sending in a "Cookie" header as defined in RFC 2109- Specified by:
formatCookiein interfaceCookieSpec- Overrides:
formatCookiein classCookieSpecBase- Parameters:
cookie- aCookieto be formatted as string- Returns:
- a string suitable for sending in a "Cookie" header.
-
formatCookies
public java.lang.String formatCookies(Cookie[] cookies)
Create a RFC 2109 compliant "Cookie" header value containing allCookies in cookies suitable for sending in a "Cookie" header- Specified by:
formatCookiesin interfaceCookieSpec- Overrides:
formatCookiesin classCookieSpecBase- Parameters:
cookies- an array ofCookies to be formatted- Returns:
- a string suitable for sending in a Cookie header.
-
-