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

public Class RFC6265CookieSpec

extends Object
implements CookieSpec
Class Inheritance
All Implemented Interfaces
org.apache.hc.client5.http.cookie.CookieSpec
Known Direct Subclasses
org.apache.hc.client5.http.impl.cookie.RFC6265CookieSpecBase
Annotations
@Contract
threading:SAFE
Imports
java.time.Instant, java.util.ArrayList, .BitSet, .Collections, .LinkedHashMap, .List, .Locale, .Map, java.util.concurrent.ConcurrentHashMap, org.apache.hc.client5.http.cookie.CommonCookieAttributeHandler, .Cookie, .CookieAttributeHandler, .CookieOrigin, .CookiePriorityComparator, .CookieSpec, .MalformedCookieException, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.FormattedHeader, .Header, .ParseException, org.apache.hc.core5.http.message.BufferedHeader, org.apache.hc.core5.util.Args, .CharArrayBuffer, .Tokenizer

Cookie management functions shared by RFC 6265 compliant specification.
Since
4.5

Field Summary

Modifier and TypeField and Description
private final Map<String, CookieAttributeHandler>
private final CookieAttributeHandler[]
private static final char
private static final char
private static final char
private static final char
private static final char
private static final BitSet
private static final BitSet
private final Tokenizer
private static final BitSet

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
containsChars(final CharSequence s, final BitSet chars)

pack-priv boolean
public List<Header>
formatCookies(final List<Cookie>
the Cookies format into a Cookie header
cookies
)

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

Create "Cookie" headers for an array of Cookies.
pack-priv static String
pack-priv static String
public final boolean
match(final Cookie
the Cookie to be matched
cookie
,
final CookieOrigin
the target to test against
origin
)

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

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

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

Parse the "Set-Cookie" Header into an array of Cookies.
public final void
validate(final Cookie
the Cookie to validate
cookie
,
final CookieOrigin
details of the cookie origin
origin
)

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

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

Field Detail

attribHandlerMapback to summary
private final Map<String, CookieAttributeHandler> attribHandlerMap
attribHandlersback to summary
private final CookieAttributeHandler[] attribHandlers
COMMA_CHARback to summary
private static final char COMMA_CHAR
DQUOTE_CHARback to summary
private static final char DQUOTE_CHAR
EQUAL_CHARback to summary
private static final char EQUAL_CHAR
ESCAPE_CHARback to summary
private static final char ESCAPE_CHAR
PARAM_DELIMITERback to summary
private static final char PARAM_DELIMITER
SPECIAL_CHARSback to summary
private static final BitSet SPECIAL_CHARS
TOKEN_DELIMSback to summary
private static final BitSet TOKEN_DELIMS
tokenParserback to summary
private final Tokenizer tokenParser
VALUE_DELIMSback to summary
private static final BitSet VALUE_DELIMS

Constructor Detail

RFC6265CookieSpecback to summary
protected RFC6265CookieSpec(final CommonCookieAttributeHandler... handlers)

Method Detail

containsCharsback to summary
pack-priv boolean containsChars(final CharSequence s, final BitSet chars)
containsSpecialCharback to summary
pack-priv boolean containsSpecialChar(final CharSequence s)
formatCookiesback to summary
public List<Header> formatCookies(final List<Cookie> cookies)

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

Doc from org.apache.hc.client5.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
getDefaultDomainback to summary
pack-priv static String getDefaultDomain(final CookieOrigin origin)
getDefaultPathback to summary
pack-priv static String getDefaultPath(final CookieOrigin origin)
matchback to summary
public final boolean match(final Cookie cookie, final CookieOrigin origin)

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

Doc from org.apache.hc.client5.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 final List<Cookie> parse(final Header header, final CookieOrigin origin) throws MalformedCookieException

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

Doc from org.apache.hc.client5.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
validateback to summary
public final void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException

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

Doc from org.apache.hc.client5.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