public class

BestMatchSpec

extends Object
implements CookieSpec
java.lang.Object
   ↳ org.apache.http.impl.cookie.BestMatchSpec

Class Overview

'Meta' cookie specification that picks up a cookie policy based on the format of cookies sent with the HTTP response.

Summary

Public Constructors
BestMatchSpec(String[] datepatterns, boolean oneHeader)
BestMatchSpec()
Public Methods
List<Header> formatCookies(List<Cookie> cookies)
Create "Cookie" headers for an array of Cookies.
int getVersion()
Returns version of the state management this cookie specification conforms to.
Header getVersionHeader()
Returns a request header identifying what version of the state management specification is understood.
boolean match(Cookie cookie, CookieOrigin origin)
Determines if a Cookie matches the target location.
List<Cookie> parse(Header header, CookieOrigin origin)
Parse the "Set-Cookie" Header into an array of Cookies.
String toString()
void validate(Cookie cookie, CookieOrigin origin)
Validate the cookie according to validation rules defined by the cookie specification.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.cookie.CookieSpec

Public Constructors

public BestMatchSpec (String[] datepatterns, boolean oneHeader)

Also: HttpClient

public BestMatchSpec ()

Also: HttpClient

Public Methods

public List<Header> formatCookies (List<Cookie> cookies)

Also: HttpClient

Create "Cookie" headers for an array of Cookies.

Parameters
cookies the Cookies format into a Cookie header
Returns
  • a Header for the given Cookies.

public int getVersion ()

Also: HttpClient

Returns version of the state management this cookie specification conforms to.

Returns
  • version of the state management specification

public Header getVersionHeader ()

Also: HttpClient

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 boolean match (Cookie cookie, CookieOrigin origin)

Also: HttpClient

Determines if a Cookie matches the target location.

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

public List<Cookie> parse (Header header, CookieOrigin origin)

Also: HttpClient

Parse the "Set-Cookie" Header into an array of Cookies.

This method will not perform the validation of the resultant Cookies

Parameters
header the Set-Cookie received from the server
origin details of the cookie origin
Returns
  • an array of Cookies parsed from the header

public String toString ()

public void validate (Cookie cookie, CookieOrigin origin)

Also: HttpClient

Validate the cookie according to validation rules defined by the cookie specification.

Parameters
cookie the Cookie to validate
origin details of the cookie origin