ServerCookieDecoder Class — netty Architecture
Architecture documentation for the ServerCookieDecoder class in ServerCookieDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e6bac091_0588_16b9_39ac_f7dd0fbd4d55["ServerCookieDecoder"] ef97268f_c3f2_f218_0836_7601aba0e2b4["ServerCookieDecoder.java"] e6bac091_0588_16b9_39ac_f7dd0fbd4d55 -->|defined in| ef97268f_c3f2_f218_0836_7601aba0e2b4 5287fe0f_3ee2_9d1f_901e_7051c5089380["ServerCookieDecoder()"] e6bac091_0588_16b9_39ac_f7dd0fbd4d55 -->|method| 5287fe0f_3ee2_9d1f_901e_7051c5089380 7896ef17_6393_c14b_ae30_30f1ed102d8f["decodeAll()"] e6bac091_0588_16b9_39ac_f7dd0fbd4d55 -->|method| 7896ef17_6393_c14b_ae30_30f1ed102d8f fa04caa7_eee9_9d6a_2c5a_bdbbb29e4041["decode()"] e6bac091_0588_16b9_39ac_f7dd0fbd4d55 -->|method| fa04caa7_eee9_9d6a_2c5a_bdbbb29e4041
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieDecoder.java lines 37–175
public final class ServerCookieDecoder extends CookieDecoder {
private static final String RFC2965_VERSION = "$Version";
private static final String RFC2965_PATH = "$" + CookieHeaderNames.PATH;
private static final String RFC2965_DOMAIN = "$" + CookieHeaderNames.DOMAIN;
private static final String RFC2965_PORT = "$Port";
/**
* Strict decoder that validates that name and value chars are in the valid scope
* defined in RFC6265
*/
public static final ServerCookieDecoder STRICT = new ServerCookieDecoder(true);
/**
* Lax instance that doesn't validate name and value
*/
public static final ServerCookieDecoder LAX = new ServerCookieDecoder(false);
private ServerCookieDecoder(boolean strict) {
super(strict);
}
/**
* Decodes the specified {@code Cookie} HTTP header value into a {@link Cookie}. Unlike {@link #decode(String)},
* this includes all cookie values present, even if they have the same name.
*
* @return the decoded {@link Cookie}
*/
public List<Cookie> decodeAll(String header) {
List<Cookie> cookies = new ArrayList<Cookie>();
decode(cookies, header);
return Collections.unmodifiableList(cookies);
}
/**
* Decodes the specified {@code Cookie} HTTP header value into a {@link Cookie}.
*
* @return the decoded {@link Cookie}
*/
public Set<Cookie> decode(String header) {
Set<Cookie> cookies = new TreeSet<Cookie>();
decode(cookies, header);
return cookies;
}
/**
* Decodes the specified {@code Cookie} HTTP header value into a {@link Cookie}.
*/
private void decode(Collection<? super Cookie> cookies, String header) {
final int headerLen = checkNotNull(header, "header").length();
if (headerLen == 0) {
return;
}
int i = 0;
boolean rfc2965Style = false;
if (header.regionMatches(true, 0, RFC2965_VERSION, 0, RFC2965_VERSION.length())) {
// RFC 2965 style cookie, move to after version value
i = header.indexOf(';') + 1;
rfc2965Style = true;
}
loop: for (;;) {
// Skip spaces and separators.
for (;;) {
if (i == headerLen) {
break loop;
}
char c = header.charAt(i);
if (c == '\t' || c == '\n' || c == 0x0b || c == '\f'
|| c == '\r' || c == ' ' || c == ',' || c == ';') {
i++;
continue;
}
break;
Source
Frequently Asked Questions
What is the ServerCookieDecoder class?
ServerCookieDecoder is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieDecoder.java.
Where is ServerCookieDecoder defined?
ServerCookieDecoder is defined in codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieDecoder.java at line 37.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free