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

public Class RFC2109Spec

extends CookieSpecBase
Class Inheritance
Known Direct Subclasses
org.apache.http.impl.cookie.RFC2965Spec
Annotations
@Obsolete
@Contract
threading:SAFE
Imports
java.util.ArrayList, .Collections, .List, org.apache.http.Header, .HeaderElement, org.apache.http.annotation.Contract, .Obsolete, .ThreadingBehavior, org.apache.http.client.utils.DateUtils, org.apache.http.cookie.ClientCookie, .CommonCookieAttributeHandler, .Cookie, .CookieOrigin, .CookiePathComparator, .CookieRestrictionViolationException, .MalformedCookieException, .SM, org.apache.http.message.BufferedHeader, org.apache.http.util.Args, .CharArrayBuffer

RFC 2109 compliant org.apache.http.cookie.CookieSpec implementation.

Rendered obsolete by org.apache.http.impl.cookie.RFC6265StrictSpec.

Since
4.0
See Also
org.apache.http.impl.cookie.RFC6265StrictSpec

Field Summary

Modifier and TypeField and Description
pack-priv static final String[]
private final boolean

Constructor Summary

AccessConstructor and Description
public
RFC2109Spec(final String[] datepatterns, final boolean oneHeader)

Default constructor

public
RFC2109Spec()

Default constructor

protected
RFC2109Spec(final boolean oneHeader, final CommonCookieAttributeHandler... handlers)

Method Summary

Modifier and TypeMethod and Description
private List<Header>
private List<Header>
doFormatOneHeader(final List<Cookie> cookies)

protected void
formatCookieAsVer(final CharArrayBuffer
The char array buffer to use for output
buffer
,
final Cookie
The Cookie to be formatted as string
cookie
,
final int
The version to use.
version
)

Return a string suitable for sending in a "Cookie" header as defined in RFC 2109 for backward compatibility with cookie version 0

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.
protected void
formatParamAsVer(final CharArrayBuffer
The char array buffer to use for output
buffer
,
final String
The cookie name
name
,
final String
The cookie value
value
,
final int
The cookie version
version
)

Return a name/value string suitable for sending in a "Cookie" header as defined in RFC 2109 for backward compatibility with cookie version 0

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 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
)

Overrides org.apache.http.impl.cookie.CookieSpecBase.validate.

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

Validate the cookie according to validation rules defined by the cookie specification.
Inherited from org.apache.http.impl.cookie.CookieSpecBase:
getDefaultDomaingetDefaultPathmatchparse

Field Detail

DATE_PATTERNSback to summary
pack-priv static final String[] DATE_PATTERNS
oneHeaderback to summary
private final boolean oneHeader

Constructor Detail

RFC2109Specback to summary
public RFC2109Spec(final String[] datepatterns, final boolean oneHeader)

Default constructor

RFC2109Specback to summary
public RFC2109Spec()

Default constructor

RFC2109Specback to summary
protected RFC2109Spec(final boolean oneHeader, final CommonCookieAttributeHandler... handlers)

Method Detail

doFormatManyHeadersback to summary
private List<Header> doFormatManyHeaders(final List<Cookie> cookies)
doFormatOneHeaderback to summary
private List<Header> doFormatOneHeader(final List<Cookie> cookies)
formatCookieAsVerback to summary
protected void formatCookieAsVer(final CharArrayBuffer buffer, final Cookie cookie, final int version)

Return a string suitable for sending in a "Cookie" header as defined in RFC 2109 for backward compatibility with cookie version 0

Parameters
buffer:CharArrayBuffer

The char array buffer to use for output

cookie:Cookie

The Cookie to be formatted as string

version:int

The version to use.

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
formatParamAsVerback to summary
protected void formatParamAsVer(final CharArrayBuffer buffer, final String name, final String value, final int version)

Return a name/value string suitable for sending in a "Cookie" header as defined in RFC 2109 for backward compatibility with cookie version 0

Parameters
buffer:CharArrayBuffer

The char array buffer to use for output

name:String

The cookie name

value:String

The cookie value

version:int

The cookie version

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
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

Overrides org.apache.http.impl.cookie.CookieSpecBase.validate.

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