CookieDecoder Class — netty Architecture
Architecture documentation for the CookieDecoder class in CookieDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 841c58a8_6f5c_8c20_e8ec_e79013189bd7["CookieDecoder"] cadc1e3f_6457_5d9e_d685_06a863fa6cd6["CookieDecoder.java"] 841c58a8_6f5c_8c20_e8ec_e79013189bd7 -->|defined in| cadc1e3f_6457_5d9e_d685_06a863fa6cd6 a4e9d1b0_cb31_cf5d_7a26_47deaaacbba9["decode()"] 841c58a8_6f5c_8c20_e8ec_e79013189bd7 -->|method| a4e9d1b0_cb31_cf5d_7a26_47deaaacbba9 e1c540fe_01b6_4343_87c4_733c1786c03f["doDecode()"] 841c58a8_6f5c_8c20_e8ec_e79013189bd7 -->|method| e1c540fe_01b6_4343_87c4_733c1786c03f 7ed26cac_407c_b1e7_ec80_dd3437b5d703["extractKeyValuePairs()"] 841c58a8_6f5c_8c20_e8ec_e79013189bd7 -->|method| 7ed26cac_407c_b1e7_ec80_dd3437b5d703 1732b851_0122_ab02_be25_e23064b1cd25["CookieDecoder()"] 841c58a8_6f5c_8c20_e8ec_e79013189bd7 -->|method| 1732b851_0122_ab02_be25_e23064b1cd25 4b7acde2_d057_5b08_cc05_1199e83d8bbd["DefaultCookie()"] 841c58a8_6f5c_8c20_e8ec_e79013189bd7 -->|method| 4b7acde2_d057_5b08_cc05_1199e83d8bbd
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java lines 50–369
@Deprecated
public final class CookieDecoder {
private final InternalLogger logger = InternalLoggerFactory.getInstance(getClass());
private static final CookieDecoder STRICT = new CookieDecoder(true);
private static final CookieDecoder LAX = new CookieDecoder(false);
private static final String COMMENT = "Comment";
private static final String COMMENTURL = "CommentURL";
private static final String DISCARD = "Discard";
private static final String PORT = "Port";
private static final String VERSION = "Version";
private final boolean strict;
public static Set<Cookie> decode(String header) {
return decode(header, true);
}
public static Set<Cookie> decode(String header, boolean strict) {
return (strict ? STRICT : LAX).doDecode(header);
}
/**
* Decodes the specified HTTP header value into {@link Cookie}s.
*
* @return the decoded {@link Cookie}s
*/
private Set<Cookie> doDecode(String header) {
List<String> names = new ArrayList<String>(8);
List<String> values = new ArrayList<String>(8);
extractKeyValuePairs(header, names, values);
if (names.isEmpty()) {
return Collections.emptySet();
}
int i;
int version = 0;
// $Version is the only attribute that can appear before the actual
// cookie name-value pair.
if (names.get(0).equalsIgnoreCase(VERSION)) {
try {
version = Integer.parseInt(values.get(0));
} catch (NumberFormatException e) {
// Ignore.
}
i = 1;
} else {
i = 0;
}
if (names.size() <= i) {
// There's a version attribute, but nothing more.
return Collections.emptySet();
}
Set<Cookie> cookies = new TreeSet<Cookie>();
for (; i < names.size(); i ++) {
String name = names.get(i);
String value = values.get(i);
if (value == null) {
value = "";
}
Cookie c = initCookie(name, value);
if (c == null) {
break;
}
boolean discard = false;
boolean secure = false;
boolean httpOnly = false;
Source
Frequently Asked Questions
What is the CookieDecoder class?
CookieDecoder is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java.
Where is CookieDecoder defined?
CookieDecoder is defined in codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java at line 50.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free