Top Description Fields Constructors Methods
org.glassfish.grizzly.http.util

public Class CookieParserUtils

extends Object
Class Inheritance
Static Imports
org.glassfish.grizzly.http.util.CookieUtils.COOKIE_VERSION_ONE_STRICT_COMPLIANCE, .CookieUtils.OLD_COOKIE_FORMAT, .CookieUtils.RFC_6265_SUPPORT_ENABLED, .CookieUtils.equalsIgnoreCase, .CookieUtils.getQuotedValueEndPosition, .CookieUtils.getTokenEndPosition, .CookieUtils.isSeparator, .CookieUtils.isWhiteSpace

The set of Cookie utility methods for cookie parsing. There is duplication of logic within which we know to be frowned upon, however it is done with performance in mind.
Author
Grizzly team

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static int
getMaxAgeDelta(long date1, long date2)

public static void
parseClientCookies(Cookies cookies, Buffer buffer, int off, int len)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

public static void
parseClientCookies(Cookies cookies, Buffer buffer, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

public static void
parseClientCookies(Cookies cookies, byte[] bytes, int off, int len)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

public static void
parseClientCookies(Cookies cookies, byte[] bytes, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

public static void
parseClientCookies(Cookies cookies, String cookiesStr, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

public static void
parseServerCookies(Cookies cookies, byte[] bytes, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

public static void
parseServerCookies(Cookies cookies, Buffer buffer, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

public static void
parseServerCookies(Cookies cookies, String cookiesStr, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

public static void
unescapeDoubleQuotes(DataChunk
The cookie value to modify
dc
)

Unescapes any double quotes in the given cookie value.

public static void
unescapeDoubleQuotes(final ByteChunk
The cookie value to modify
bc
)

Unescapes any double quotes in the given cookie value.

public static void
unescapeDoubleQuotes(BufferChunk
The cookie value to modify
bc
)

Unescapes any double quotes in the given cookie value.

public static void
unescapeDoubleQuotes(CharChunk
The cookie value to modify
cc
)

Unescapes any double quotes in the given cookie value.

public static int

Returns:

new length
unescapeDoubleQuotes
(Buffer
the cookie buffer.
buffer
,
int
start position.
start
,
int
number of bytes to un-escape.
length
)

Un-escapes any double quotes in the given cookie value.

public static String

Returns:

new String
unescapeDoubleQuotes
(String
The cookie value to modify
s
,
int start, int length)

Unescapes any double quotes in the given cookie value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

CookieParserUtilsback to summary
public CookieParserUtils()

Method Detail

getMaxAgeDeltaback to summary
private static int getMaxAgeDelta(long date1, long date2)
parseClientCookiesback to summary
public static void parseClientCookies(Cookies cookies, Buffer buffer, int off, int len)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

parseClientCookiesback to summary
public static void parseClientCookies(Cookies cookies, Buffer buffer, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

parseClientCookiesback to summary
public static void parseClientCookies(Cookies cookies, byte[] bytes, int off, int len)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

parseClientCookiesback to summary
public static void parseClientCookies(Cookies cookies, byte[] bytes, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

parseClientCookiesback to summary
public static void parseClientCookies(Cookies cookies, String cookiesStr, boolean versionOneStrictCompliance, boolean rfc6265Enabled)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK

parseServerCookiesback to summary
public static void parseServerCookies(Cookies cookies, byte[] bytes, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)
parseServerCookiesback to summary
public static void parseServerCookies(Cookies cookies, Buffer buffer, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)
parseServerCookiesback to summary
public static void parseServerCookies(Cookies cookies, String cookiesStr, boolean versionOneStrictCompliance, boolean rfc6265Enabled)
unescapeDoubleQuotesback to summary
public static void unescapeDoubleQuotes(DataChunk dc)

Unescapes any double quotes in the given cookie value.

Parameters
dc:DataChunk

The cookie value to modify

unescapeDoubleQuotesback to summary
public static void unescapeDoubleQuotes(final ByteChunk bc)

Unescapes any double quotes in the given cookie value.

Parameters
bc:ByteChunk

The cookie value to modify

unescapeDoubleQuotesback to summary
public static void unescapeDoubleQuotes(BufferChunk bc)

Unescapes any double quotes in the given cookie value.

Parameters
bc:BufferChunk

The cookie value to modify

unescapeDoubleQuotesback to summary
public static void unescapeDoubleQuotes(CharChunk cc)

Unescapes any double quotes in the given cookie value.

Parameters
cc:CharChunk

The cookie value to modify

Annotations
@SuppressWarnings:UnusedDeclaration
unescapeDoubleQuotesback to summary
public static int unescapeDoubleQuotes(Buffer buffer, int start, int length)

Un-escapes any double quotes in the given cookie value.

Parameters
buffer:Buffer

the cookie buffer.

start:int

start position.

length:int

number of bytes to un-escape.

Returns:int

new length

Annotations
@SuppressWarnings:UnusedDeclaration
unescapeDoubleQuotesback to summary
public static String unescapeDoubleQuotes(String s, int start, int length)

Unescapes any double quotes in the given cookie value.

Parameters
s:String

The cookie value to modify

Returns:String

new String