encodeInitialLine() — netty Function Reference
Architecture documentation for the encodeInitialLine() function in HttpRequestEncoderInsertBenchmark.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d8ec1bab_636b_f9db_0508_d4b0e388cd9e["encodeInitialLine()"] 2f956472_bc87_1c95_4c11_2058f3441b56["OldHttpRequestEncoder"] d8ec1bab_636b_f9db_0508_d4b0e388cd9e -->|defined in| 2f956472_bc87_1c95_4c11_2058f3441b56 a422f1ab_5356_fda9_202c_ed213f3d5ca3["ByteBuf()"] a422f1ab_5356_fda9_202c_ed213f3d5ca3 -->|calls| d8ec1bab_636b_f9db_0508_d4b0e388cd9e style d8ec1bab_636b_f9db_0508_d4b0e388cd9e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
microbench/src/main/java/io/netty/handler/codec/http/HttpRequestEncoderInsertBenchmark.java lines 146–187
@Override
protected void encodeInitialLine(ByteBuf buf, HttpRequest request) throws Exception {
AsciiString method = request.method().asciiName();
ByteBufUtil.copy(method, method.arrayOffset(), buf, method.length());
buf.writeByte(SP);
// Add / as absolute path if no is present.
// See https://tools.ietf.org/html/rfc2616#section-5.1.2
String uri = request.uri();
if (uri.isEmpty()) {
uri += SLASH;
} else {
int start = uri.indexOf("://");
if (start != -1 && uri.charAt(0) != SLASH) {
int startIndex = start + 3;
// Correctly handle query params.
// See https://github.com/netty/netty/issues/2732
int index = uri.indexOf(QUESTION_MARK, startIndex);
if (index == -1) {
if (uri.lastIndexOf(SLASH) <= startIndex) {
uri += SLASH;
}
} else {
if (uri.lastIndexOf(SLASH, index) <= startIndex) {
int len = uri.length();
StringBuilder sb = new StringBuilder(len + 1);
sb.append(uri, 0, index)
.append(SLASH)
.append(uri, index, len);
uri = sb.toString();
}
}
}
}
buf.writeBytes(uri.getBytes(CharsetUtil.UTF_8));
buf.writeByte(SP);
request.protocolVersion().encode(buf);
buf.writeBytes(CRLF);
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does encodeInitialLine() do?
encodeInitialLine() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/handler/codec/http/HttpRequestEncoderInsertBenchmark.java.
Where is encodeInitialLine() defined?
encodeInitialLine() is defined in microbench/src/main/java/io/netty/handler/codec/http/HttpRequestEncoderInsertBenchmark.java at line 146.
What calls encodeInitialLine()?
encodeInitialLine() is called by 1 function(s): ByteBuf.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free