Top Description Fields Constructors Methods
io.undertow.util

public final Class LegacyCookieSupport

extends Object
Class Inheritance
Imports
io.undertow.UndertowMessages, io.undertow.server.handlers.Cookie

Class that contains static constants and utility methods for legacy Set-Cookie format. Porting from JBossWeb and Tomcat code. Note that in general we do not use system properties for configuration, however as these are legacy options that are not widely used an exception has been made in this case.

Field Summary

Modifier and TypeField and Description
pack-priv static final boolean
ALLOW_HTTP_SEPARATORS_IN_V0

If true, separators that are not explicitly dis-allowed by the v0 cookie spec but are disallowed by the HTTP spec will be allowed in v0 cookie names and values.

pack-priv static final boolean
COMMA_IS_SEPARATOR

If set to true, the <code,< code> character will be treated as a separator in Cookie: headers.

private static final boolean
FWD_SLASH_IS_SEPARATOR

If set to true, the / character will be treated as a separator.

private static final boolean[]
private static final char[]
HTTP_SEPARATORS

The list of separators that apply to version 1 cookies.

private static final boolean[]
private static final char[]
V0_SEPARATORS

The list of separators that apply to version 0 cookies.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static int
private static boolean
private static String

Returns:

The (possibly) escaped string
escapeDoubleQuotes
(String
the input string
s
,
int
start index inclusive
beginIndex
,
int
exclusive
endIndex
)

Escapes any double quotes in the given string.

pack-priv static boolean
isHttpSeparator(final char c)

Returns true if the byte is a separator as defined by V1 of the cookie spec, RFC2109.

private static boolean
private static boolean
isV0Separator(final char c)

Returns true if the byte is a separator as defined by V0 of the cookie spec.

private static boolean
public static void
maybeQuote(StringBuilder buf, String value)

Quotes values if required.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALLOW_HTTP_SEPARATORS_IN_V0back to summary
pack-priv static final boolean ALLOW_HTTP_SEPARATORS_IN_V0

If true, separators that are not explicitly dis-allowed by the v0 cookie spec but are disallowed by the HTTP spec will be allowed in v0 cookie names and values. These characters are: \"()/:<=>?@[\\]{} Note that the inclusion of / depend on the value of FWD_SLASH_IS_SEPARATOR. Defaults to false.

COMMA_IS_SEPARATORback to summary
pack-priv static final boolean COMMA_IS_SEPARATOR

If set to true, the character will be treated as a separator in Cookie: headers.

FWD_SLASH_IS_SEPARATORback to summary
private static final boolean FWD_SLASH_IS_SEPARATOR

If set to true, the / character will be treated as a separator. Default is false.

HTTP_SEPARATOR_FLAGSback to summary
private static final boolean[] HTTP_SEPARATOR_FLAGS
HTTP_SEPARATORSback to summary
private static final char[] HTTP_SEPARATORS

The list of separators that apply to version 1 cookies. This may or may not include '/' depending on the setting of FWD_SLASH_IS_SEPARATOR.

V0_SEPARATOR_FLAGSback to summary
private static final boolean[] V0_SEPARATOR_FLAGS
V0_SEPARATORSback to summary
private static final char[] V0_SEPARATORS

The list of separators that apply to version 0 cookies. To quote the spec, these are comma, semi-colon and white-space. The HTTP spec definition of linear white space is [CRLF] 1*( SP | HT )

Constructor Detail

LegacyCookieSupportback to summary
private LegacyCookieSupport()

Method Detail

adjustedCookieVersionback to summary
public static int adjustedCookieVersion(Cookie cookie)
alreadyQuotedback to summary
private static boolean alreadyQuoted(String value)
escapeDoubleQuotesback to summary
private static String escapeDoubleQuotes(String s, int beginIndex, int endIndex)

Escapes any double quotes in the given string.

Parameters
s:String

the input string

beginIndex:int

start index inclusive

endIndex:int

exclusive

Returns:String

The (possibly) escaped string

isHttpSeparatorback to summary
pack-priv static boolean isHttpSeparator(final char c)

Returns true if the byte is a separator as defined by V1 of the cookie spec, RFC2109.

Exceptions
IllegalArgumentException:
if a control character was supplied as input
isHttpTokenback to summary
private static boolean isHttpToken(String value)
isV0Separatorback to summary
private static boolean isV0Separator(final char c)

Returns true if the byte is a separator as defined by V0 of the cookie spec.

isV0Tokenback to summary
private static boolean isV0Token(String value)
maybeQuoteback to summary
public static void maybeQuote(StringBuilder buf, String value)

Quotes values if required.