org.apache.commons.httpclient.cookie
public interface CookieSpec
Cookie management specification must define
Since: 2.0
Field Summary | |
---|---|
static String | PATH_DELIM Path delimiter |
static char | PATH_DELIM_CHAR Path delimiting charachter |
Method Summary | |
---|---|
boolean | domainMatch(String host, String domain)
Performs domain-match as defined by the cookie specification. |
String | formatCookie(Cookie cookie)
Create a "Cookie" header value for an array of cookies.
|
Header | formatCookieHeader(Cookie[] cookies)
Create a "Cookie" Header for an array of Cookies.
|
Header | formatCookieHeader(Cookie cookie)
Create a "Cookie" Header for single Cookie.
|
String | formatCookies(Cookie[] cookies)
Create a "Cookie" header value for an array of cookies.
|
Collection | getValidDateFormats()
Returns the Collection of date patterns used for parsing. |
boolean | match(String host, int port, String path, boolean secure, Cookie cookie)
Determines if a Cookie matches a location.
|
Cookie[] | match(String host, int port, String path, boolean secure, Cookie[] cookies)
Determines which of an array of Cookies matches a location.
|
Cookie[] | parse(String host, int port, String path, boolean secure, String header)
Parse the "Set-Cookie" header value into Cookie array.
|
Cookie[] | parse(String host, int port, String path, boolean secure, Header header)
Parse the "Set-Cookie" Header into an array of Cookies.
|
void | parseAttribute(NameValuePair attribute, Cookie cookie)
Parse the cookie attribute and update the corresponsing Cookie
properties.
|
boolean | pathMatch(String path, String topmostPath)
Performs path-match as defined by the cookie specification. |
void | setValidDateFormats(Collection datepatterns)
Sets the Collection of date patterns used for parsing. |
void | validate(String host, int port, String path, boolean secure, Cookie cookie)
Validate the cookie according to validation rules defined by the
cookie specification.
|
Parameters: host The target host. domain The cookie domain attribute.
Returns: true if the specified host matches the given domain.
Since: 3.0
Parameters: cookie the cookie to be formatted as string
Returns: a string suitable for sending in a "Cookie" header.
Parameters: cookies the Cookies format into a Cookie header
Returns: a Header for the given Cookies.
Throws: IllegalArgumentException if an input parameter is illegal
Parameters: cookie the Cookie format as a Cookie header
Returns: a Cookie header.
Throws: IllegalArgumentException if an input parameter is illegal
Parameters: cookies the Cookies to be formatted
Returns: a string suitable for sending in a Cookie header.
Throws: IllegalArgumentException if an input parameter is illegal
Returns: collection of date patterns
Parameters: host the host to which the request is being submitted port the port to which the request is being submitted path the path to which the request is being submitted secure true if the request is using a secure connection cookie the Cookie to be matched
Returns: true if the cookie should be submitted with a request with given attributes, false otherwise.
Parameters: host the host to which the request is being submitted port the port to which the request is being submitted (currenlty ignored) path the path to which the request is being submitted secure true if the request is using a secure protocol cookies an array of Cookies to be matched
Returns: true if the cookie should be submitted with a request with given attributes, false otherwise.
This method will not perform the validation of the resultant Cookies
Parameters: host the host which sent the Set-Cookie header port the port which sent the Set-Cookie header path the path which sent the Set-Cookie header secure true when the Set-Cookie header was received over secure conection header the Set-Cookie received from the server
Returns: an array of Cookies parsed from the Set-Cookie value
Throws: MalformedCookieException if an exception occurs during parsing IllegalArgumentException if an input parameter is illegal
This method will not perform the validation of the resultant Cookies
Parameters: host the host which sent the Set-Cookie header port the port which sent the Set-Cookie header path the path which sent the Set-Cookie header secure true when the Set-Cookie header was received over secure conection header the Set-Cookie received from the server
Returns: an array of Cookies parsed from the header
Throws: MalformedCookieException if an exception occurs during parsing IllegalArgumentException if an input parameter is illegal
Parameters: attribute cookie attribute from the Set-Cookie cookie the to be updated
Throws: MalformedCookieException if an exception occurs during parsing IllegalArgumentException if an input parameter is illegal
Parameters: path The target path. topmostPath The cookie path attribute.
Returns: true if the paths match
Since: 3.0
Parameters: datepatterns collection of date patterns
Parameters: host the host from which the Cookie was received port the port from which the Cookie was received path the path from which the Cookie was received secure true when the Cookie was received using a secure connection cookie the Cookie to validate
Throws: MalformedCookieException if the cookie is invalid IllegalArgumentException if an input parameter is illegal