Top Description Fields Constructors Methods
org.apache.http.impl.cookie

public Class DefaultCookieSpec

extends Object
implements CookieSpec
Class Inheritance
All Implemented Interfaces
org.apache.http.cookie.CookieSpec
Known Direct Subclasses
org.apache.http.impl.cookie.BestMatchSpec
Annotations
@Contract
threading:SAFE
Imports
java.util.List, org.apache.http.FormattedHeader, .Header, .HeaderElement, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.cookie.Cookie, .CookieOrigin, .CookieSpec, .MalformedCookieException, .SM, .SetCookie2, org.apache.http.message.ParserCursor, org.apache.http.util.Args, .CharArrayBuffer

Default cookie specification that picks up the best matching cookie policy based on the format of cookies sent with the HTTP response.
Since
4.4

Field Summary

Modifier and TypeField and Description
private final NetscapeDraftSpec
private final RFC2109Spec
private final RFC2965Spec

Constructor Summary

AccessConstructor and Description
pack-priv
DefaultCookieSpec(final RFC2965Spec strict, final RFC2109Spec obsoleteStrict, final NetscapeDraftSpec netscapeDraft)

public
DefaultCookieSpec(final String[] datepatterns, final boolean oneHeader)

public

Method Summary

Modifier and TypeMethod and Description
public List<Header>
formatCookies(final List<Cookie>
the Cookies format into a Cookie header
cookies
)

Implements org.apache.http.cookie.CookieSpec.formatCookies.

Create "Cookie" headers for an array of Cookies.
public int
getVersion()

Implements org.apache.http.cookie.CookieSpec.getVersion.

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

Implements org.apache.http.cookie.CookieSpec.getVersionHeader.

Returns a request header identifying what version of the state management specification is understood.
public boolean
match(final Cookie
the Cookie to be matched
cookie
,
final CookieOrigin
the target to test against
origin
)

Implements org.apache.http.cookie.CookieSpec.match.

Determines if a Cookie matches the target location.
public List<Cookie>
parse(final Header
the Set-Cookie received from the server
header
,
final CookieOrigin
details of the cookie origin
origin
)

Implements org.apache.http.cookie.CookieSpec.parse.

Parse the "Set-Cookie" Header into an array of Cookies.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
validate(final Cookie
the Cookie to validate
cookie
,
final CookieOrigin
details of the cookie origin
origin
)

Implements org.apache.http.cookie.CookieSpec.validate.

Validate the cookie according to validation rules defined by the cookie specification.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

netscapeDraftback to summary
private final NetscapeDraftSpec netscapeDraft
obsoleteStrictback to summary
private final RFC2109Spec obsoleteStrict
strictback to summary
private final RFC2965Spec strict

Constructor Detail

DefaultCookieSpecback to summary
pack-priv DefaultCookieSpec(final RFC2965Spec strict, final RFC2109Spec obsoleteStrict, final NetscapeDraftSpec netscapeDraft)
DefaultCookieSpecback to summary
public DefaultCookieSpec(final String[] datepatterns, final boolean oneHeader)
DefaultCookieSpecback to summary
public DefaultCookieSpec()

Method Detail

formatCookiesback to summary
public List<Header> formatCookies(final List<Cookie> cookies)

Implements org.apache.http.cookie.CookieSpec.formatCookies.

Doc from org.apache.http.cookie.CookieSpec.formatCookies.

Create "Cookie" headers for an array of Cookies.

Parameters
cookies:List<Cookie>

the Cookies format into a Cookie header

Returns:List<Header>

a Header for the given Cookies.

Annotations
@Override
getVersionback to summary
public int getVersion()

Implements org.apache.http.cookie.CookieSpec.getVersion.

Doc from org.apache.http.cookie.CookieSpec.getVersion.

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

Returns:int

version of the state management specification

Annotations
@Override
getVersionHeaderback to summary
public Header getVersionHeader()

Implements org.apache.http.cookie.CookieSpec.getVersionHeader.

Doc from org.apache.http.cookie.CookieSpec.getVersionHeader.

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.

Annotations
@Override
matchback to summary
public boolean match(final Cookie cookie, final CookieOrigin origin)

Implements org.apache.http.cookie.CookieSpec.match.

Doc from org.apache.http.cookie.CookieSpec.match.

Determines if a Cookie matches the target location.

Parameters
cookie:Cookie

the Cookie to be matched

origin:CookieOrigin

the target to test against

Returns:boolean

true if the cookie should be submitted with a request with given attributes, false otherwise.

Annotations
@Override
parseback to summary
public List<Cookie> parse(final Header header, final CookieOrigin origin) throws MalformedCookieException

Implements org.apache.http.cookie.CookieSpec.parse.

Doc from org.apache.http.cookie.CookieSpec.parse.

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

This method will not perform the validation of the resultant Cookies

Parameters
header:Header

the Set-Cookie received from the server

origin:CookieOrigin

details of the cookie origin

Returns:List<Cookie>

an array of Cookies parsed from the header

Annotations
@Override
Exceptions
MalformedCookieException:
if an exception occurs during parsing
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
validateback to summary
public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException

Implements org.apache.http.cookie.CookieSpec.validate.

Doc from org.apache.http.cookie.CookieSpec.validate.

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

Parameters
cookie:Cookie

the Cookie to validate

origin:CookieOrigin

details of the cookie origin

Annotations
@Override
Exceptions
MalformedCookieException:
if the cookie is invalid