DefaultHttp2Headers Class — netty Architecture
Architecture documentation for the DefaultHttp2Headers class in DefaultHttp2Headers.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3254a375_87df_eb7d_4edf_7ace10c77838["DefaultHttp2Headers"] a9793c8f_4c63_b024_a082_4126b7788d89["DefaultHttp2Headers.java"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|defined in| a9793c8f_4c63_b024_a082_4126b7788d89 2fe3a3dc_4c33_9ddc_42a0_b33052f7b45f["DefaultHttp2Headers()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| 2fe3a3dc_4c33_9ddc_42a0_b33052f7b45f bd0e9096_0c40_ac59_1fd3_3d077db261dc["validateName()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| bd0e9096_0c40_ac59_1fd3_3d077db261dc 535ebca6_26d2_982a_6521_3399865a266b["validateValue()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| 535ebca6_26d2_982a_6521_3399865a266b 5c69b632_44c6_a45b_bc88_5eaa9e856f1c["Http2Headers()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| 5c69b632_44c6_a45b_bc88_5eaa9e856f1c 8684e4cd_6fb1_2377_9b6e_8d741bd68419["equals()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| 8684e4cd_6fb1_2377_9b6e_8d741bd68419 fc3a9c3b_5b83_d959_46e1_93a4528823d5["hashCode()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| fc3a9c3b_5b83_d959_46e1_93a4528823d5 99cd1e3b_0e5e_0b20_6686_dc354067b65a["CharSequence()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| 99cd1e3b_0e5e_0b20_6686_dc354067b65a 272a0816_c11f_0e4c_9326_4f6e57babccf["contains()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| 272a0816_c11f_0e4c_9326_4f6e57babccf d4fd8d42_6053_ce6f_0c1b_0e9043caa000["newHeaderEntry()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| d4fd8d42_6053_ce6f_0c1b_0e9043caa000 47b6b696_757d_c459_c166_3093e5e4565d["defaultHtt2NameValidator()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| 47b6b696_757d_c459_c166_3093e5e4565d a2985c01_ef07_1b15_d04d_132dbe7904e9["defaultHttp2ValueValidator()"] 3254a375_87df_eb7d_4edf_7ace10c77838 -->|method| a2985c01_ef07_1b15_d04d_132dbe7904e9
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Headers.java lines 32–316
public class DefaultHttp2Headers
extends DefaultHeaders<CharSequence, CharSequence, Http2Headers> implements Http2Headers {
private static final ByteProcessor HTTP2_NAME_VALIDATOR_PROCESSOR = new ByteProcessor() {
@Override
public boolean process(byte value) {
return !isUpperCase(value);
}
};
private static final NameValidator<CharSequence> HTTP2_NAME_VALIDATOR = new NameValidator<CharSequence>() {
@Override
public void validateName(CharSequence name) {
if (name == null || name.length() == 0) {
PlatformDependent.throwException(connectionError(PROTOCOL_ERROR,
"empty headers are not allowed [%s]", name));
}
if (hasPseudoHeaderFormat(name)) {
if (!isPseudoHeader(name)) {
PlatformDependent.throwException(connectionError(
PROTOCOL_ERROR, "Invalid HTTP/2 pseudo-header '%s' encountered.", name));
}
// no need for lower-case validation, we trust our own pseudo header constants
return;
}
if (name instanceof AsciiString) {
final int index;
try {
index = ((AsciiString) name).forEachByte(HTTP2_NAME_VALIDATOR_PROCESSOR);
} catch (Http2Exception e) {
PlatformDependent.throwException(e);
return;
} catch (Throwable t) {
PlatformDependent.throwException(connectionError(PROTOCOL_ERROR, t,
"unexpected error. invalid header name [%s]", name));
return;
}
if (index != -1) {
PlatformDependent.throwException(connectionError(PROTOCOL_ERROR,
"invalid header name [%s]", name));
}
} else {
for (int i = 0; i < name.length(); ++i) {
if (isUpperCase(name.charAt(i))) {
PlatformDependent.throwException(connectionError(PROTOCOL_ERROR,
"invalid header name [%s]", name));
}
}
}
}
};
private static final ValueValidator<CharSequence> VALUE_VALIDATOR = new ValueValidator<CharSequence>() {
@Override
public void validate(CharSequence value) {
int index = HttpHeaderValidationUtil.validateValidHeaderValue(value);
if (index != -1) {
throw new IllegalArgumentException("a header value contains prohibited character 0x" +
Integer.toHexString(value.charAt(index)) + " at index " + index + '.');
}
}
};
private HeaderEntry<CharSequence, CharSequence> firstNonPseudo = head;
/**
* Create a new instance.
* <p>
* Header names will be validated according to
* <a href="https://tools.ietf.org/html/rfc7540">rfc7540</a>.
*/
public DefaultHttp2Headers() {
this(true);
}
/**
* Create a new instance.
* @param validate {@code true} to validate header names according to
* <a href="https://tools.ietf.org/html/rfc7540">rfc7540</a>. {@code false} to not validate header names.
*/
Source
Frequently Asked Questions
What is the DefaultHttp2Headers class?
DefaultHttp2Headers is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Headers.java.
Where is DefaultHttp2Headers defined?
DefaultHttp2Headers is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Headers.java at line 32.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free