FileDocCategorySizeDatePackage
CookieSpec.javaAPI DocAndroid 1.5 API4157Wed May 06 22:41:10 BST 2009org.apache.http.cookie

CookieSpec

public interface CookieSpec
Defines the cookie management specification.

Cookie management specification must define

  • rules of parsing "Set-Cookie" header
  • rules of validation of parsed cookies
  • formatting of "Cookie" header
for a given host, port and path of origin
author
Oleg Kalnichevski
author
Jeff Dever
since
4.0

Fields Summary
Constructors Summary
Methods Summary
public java.util.ListformatCookies(java.util.List cookies)
Create "Cookie" headers for an array of Cookies.

param
cookies the Cookies format into a Cookie header
return
a Header for the given Cookies.
throws
IllegalArgumentException if an input parameter is illegal

public intgetVersion()
Returns version of the state management this cookie specification conforms to.

return
version of the state management specification

public org.apache.http.HeadergetVersionHeader()
Returns a request header identifying what version of the state management specification is understood. May be null if the cookie specification does not support Cookie2 header.

public booleanmatch(org.apache.http.cookie.Cookie cookie, org.apache.http.cookie.CookieOrigin origin)
Determines if a Cookie matches the target location.

param
cookie the Cookie to be matched
param
origin the target to test against
return
true if the cookie should be submitted with a request with given attributes, false otherwise.

public java.util.Listparse(org.apache.http.Header header, org.apache.http.cookie.CookieOrigin origin)
Parse the "Set-Cookie" Header into an array of Cookies.

This method will not perform the validation of the resultant {@link Cookie}s

see
#validate
param
header the Set-Cookie received from the server
param
origin details of the cookie origin
return
an array of Cookies parsed from the header
throws
MalformedCookieException if an exception occurs during parsing

public voidvalidate(org.apache.http.cookie.Cookie cookie, org.apache.http.cookie.CookieOrigin origin)
Validate the cookie according to validation rules defined by the cookie specification.

param
cookie the Cookie to validate
param
origin details of the cookie origin
throws
MalformedCookieException if the cookie is invalid