CookieUtil Class — netty Architecture
Architecture documentation for the CookieUtil class in CookieUtil.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 2a0180af_7c8d_c2b4_07fb_724a88862fd8["CookieUtil"] 8ca516be_880f_2089_8cc3_4c4f37b05d3f["CookieUtil.java"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|defined in| 8ca516be_880f_2089_8cc3_4c4f37b05d3f 43a98f94_1f77_0b04_2296_8f2db1620fd7["BitSet()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| 43a98f94_1f77_0b04_2296_8f2db1620fd7 68affced_c6e1_5c53_704d_ebdcc48cd639["StringBuilder()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| 68affced_c6e1_5c53_704d_ebdcc48cd639 9fa939ed_09d3_c8a3_e977_6ed37a91e5a9["String()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| 9fa939ed_09d3_c8a3_e977_6ed37a91e5a9 aa26b398_86a7_150c_ee9d_cf7b83f838de["add()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| aa26b398_86a7_150c_ee9d_cf7b83f838de 2a9a460c_fdc0_8aa5_2620_5f3923a7a1c5["addQuoted()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| 2a9a460c_fdc0_8aa5_2620_5f3923a7a1c5 1483e4cb_667f_ae37_742e_dfac07a4d174["firstInvalidCookieNameOctet()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| 1483e4cb_667f_ae37_742e_dfac07a4d174 3c9ee335_4fde_652e_dad4_9dcc3dcd9ea6["firstInvalidCookieValueOctet()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| 3c9ee335_4fde_652e_dad4_9dcc3dcd9ea6 13f8b7c9_ce15_3974_9cad_dcf15e5b07e9["firstInvalidOctet()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| 13f8b7c9_ce15_3974_9cad_dcf15e5b07e9 2d7680e3_fbdf_e010_576f_64ee84ac1430["CharSequence()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| 2d7680e3_fbdf_e010_576f_64ee84ac1430 d8bcbb00_3646_68b4_3e5c_620e89013cc3["CookieUtil()"] 2a0180af_7c8d_c2b4_07fb_724a88862fd8 -->|method| d8bcbb00_3646_68b4_3e5c_620e89013cc3
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/cookie/CookieUtil.java lines 23–183
final class CookieUtil {
private static final BitSet VALID_COOKIE_NAME_OCTETS = validCookieNameOctets();
private static final BitSet VALID_COOKIE_VALUE_OCTETS = validCookieValueOctets();
private static final BitSet VALID_COOKIE_ATTRIBUTE_VALUE_OCTETS = validCookieAttributeValueOctets();
// token = 1*<any CHAR except CTLs or separators>
// separators = "(" | ")" | "<" | ">" | "@"
// | "," | ";" | ":" | "\" | <">
// | "/" | "[" | "]" | "?" | "="
// | "{" | "}" | SP | HT
private static BitSet validCookieNameOctets() {
BitSet bits = new BitSet();
for (int i = 32; i < 127; i++) {
bits.set(i);
}
int[] separators = new int[]
{ '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', '\t' };
for (int separator : separators) {
bits.set(separator, false);
}
return bits;
}
// cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
// US-ASCII characters excluding CTLs, whitespace, DQUOTE, comma, semicolon, and backslash
private static BitSet validCookieValueOctets() {
BitSet bits = new BitSet();
bits.set(0x21);
for (int i = 0x23; i <= 0x2B; i++) {
bits.set(i);
}
for (int i = 0x2D; i <= 0x3A; i++) {
bits.set(i);
}
for (int i = 0x3C; i <= 0x5B; i++) {
bits.set(i);
}
for (int i = 0x5D; i <= 0x7E; i++) {
bits.set(i);
}
return bits;
}
// path-value = <any CHAR except CTLs or ";">
private static BitSet validCookieAttributeValueOctets() {
BitSet bits = new BitSet();
for (int i = 32; i < 127; i++) {
bits.set(i);
}
bits.set(';', false);
return bits;
}
static StringBuilder stringBuilder() {
return InternalThreadLocalMap.get().stringBuilder();
}
/**
* @param buf a buffer where some cookies were maybe encoded
* @return the buffer String without the trailing separator, or null if no cookie was appended.
*/
static String stripTrailingSeparatorOrNull(StringBuilder buf) {
return buf.length() == 0 ? null : stripTrailingSeparator(buf);
}
static String stripTrailingSeparator(StringBuilder buf) {
if (buf.length() > 0) {
buf.setLength(buf.length() - 2);
}
return buf.toString();
}
static void add(StringBuilder sb, String name, long val) {
sb.append(name);
sb.append('=');
sb.append(val);
sb.append(';');
sb.append(HttpConstants.SP_CHAR);
Source
Frequently Asked Questions
What is the CookieUtil class?
CookieUtil is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/cookie/CookieUtil.java.
Where is CookieUtil defined?
CookieUtil is defined in codec-http/src/main/java/io/netty/handler/codec/http/cookie/CookieUtil.java at line 23.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free