doDecode() — netty Function Reference
Architecture documentation for the doDecode() function in CookieDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e1c540fe_01b6_4343_87c4_733c1786c03f["doDecode()"] 841c58a8_6f5c_8c20_e8ec_e79013189bd7["CookieDecoder"] e1c540fe_01b6_4343_87c4_733c1786c03f -->|defined in| 841c58a8_6f5c_8c20_e8ec_e79013189bd7 a4e9d1b0_cb31_cf5d_7a26_47deaaacbba9["decode()"] a4e9d1b0_cb31_cf5d_7a26_47deaaacbba9 -->|calls| e1c540fe_01b6_4343_87c4_733c1786c03f 7ed26cac_407c_b1e7_ec80_dd3437b5d703["extractKeyValuePairs()"] e1c540fe_01b6_4343_87c4_733c1786c03f -->|calls| 7ed26cac_407c_b1e7_ec80_dd3437b5d703 style e1c540fe_01b6_4343_87c4_733c1786c03f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java lines 84–199
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;
String comment = null;
String commentURL = null;
String domain = null;
String path = null;
long maxAge = Long.MIN_VALUE;
List<Integer> ports = new ArrayList<Integer>(2);
for (int j = i + 1; j < names.size(); j++, i++) {
name = names.get(j);
value = values.get(j);
if (DISCARD.equalsIgnoreCase(name)) {
discard = true;
} else if (CookieHeaderNames.SECURE.equalsIgnoreCase(name)) {
secure = true;
} else if (CookieHeaderNames.HTTPONLY.equalsIgnoreCase(name)) {
httpOnly = true;
} else if (COMMENT.equalsIgnoreCase(name)) {
comment = value;
} else if (COMMENTURL.equalsIgnoreCase(name)) {
commentURL = value;
} else if (CookieHeaderNames.DOMAIN.equalsIgnoreCase(name)) {
domain = value;
} else if (CookieHeaderNames.PATH.equalsIgnoreCase(name)) {
path = value;
} else if (CookieHeaderNames.EXPIRES.equalsIgnoreCase(name)) {
Date date = DateFormatter.parseHttpDate(value);
if (date != null) {
long maxAgeMillis = date.getTime() - System.currentTimeMillis();
maxAge = maxAgeMillis / 1000 + (maxAgeMillis % 1000 != 0? 1 : 0);
}
} else if (CookieHeaderNames.MAX_AGE.equalsIgnoreCase(name)) {
maxAge = Integer.parseInt(value);
} else if (VERSION.equalsIgnoreCase(name)) {
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does doDecode() do?
doDecode() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java.
Where is doDecode() defined?
doDecode() is defined in codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java at line 84.
What does doDecode() call?
doDecode() calls 1 function(s): extractKeyValuePairs.
What calls doDecode()?
doDecode() is called by 1 function(s): decode.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free