sendListing() — netty Function Reference
Architecture documentation for the sendListing() function in HttpStaticFileServerHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 2d9abdcf_0bde_4318_74f6_8a20cb48fc08["sendListing()"] 02ca82d7_508c_aabe_bb4d_dd1603c38b01["HttpStaticFileServerHandler"] 2d9abdcf_0bde_4318_74f6_8a20cb48fc08 -->|defined in| 02ca82d7_508c_aabe_bb4d_dd1603c38b01 d39f8eb8_b352_59dc_d244_4e113cd078df["channelRead0()"] d39f8eb8_b352_59dc_d244_4e113cd078df -->|calls| 2d9abdcf_0bde_4318_74f6_8a20cb48fc08 387357b5_0623_04d6_d7dd_f0074f835df9["sendAndCleanupConnection()"] 2d9abdcf_0bde_4318_74f6_8a20cb48fc08 -->|calls| 387357b5_0623_04d6_d7dd_f0074f835df9 style 2d9abdcf_0bde_4318_74f6_8a20cb48fc08 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java lines 274–318
private void sendListing(ChannelHandlerContext ctx, File dir, String dirPath) {
StringBuilder buf = new StringBuilder()
.append("<!DOCTYPE html>\r\n")
.append("<html><head><meta charset='utf-8' /><title>")
.append("Listing of: ")
.append(dirPath)
.append("</title></head><body>\r\n")
.append("<h3>Listing of: ")
.append(dirPath)
.append("</h3>\r\n")
.append("<ul>")
.append("<li><a href=\"../\">..</a></li>\r\n");
File[] files = dir.listFiles();
if (files != null) {
for (File f: files) {
if (f.isHidden() || !f.canRead()) {
continue;
}
String name = f.getName();
if (!ALLOWED_FILE_NAME.matcher(name).matches()) {
continue;
}
buf.append("<li><a href=\"")
.append(name)
.append("\">")
.append(name)
.append("</a></li>\r\n");
}
}
buf.append("</ul></body></html>\r\n");
ByteBuf buffer = ctx.alloc().buffer(buf.length());
buffer.writeCharSequence(buf.toString(), CharsetUtil.UTF_8);
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK, buffer);
response.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/html; charset=UTF-8");
sendAndCleanupConnection(ctx, response);
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does sendListing() do?
sendListing() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java.
Where is sendListing() defined?
sendListing() is defined in example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java at line 274.
What does sendListing() call?
sendListing() calls 1 function(s): sendAndCleanupConnection.
What calls sendListing()?
sendListing() is called by 1 function(s): channelRead0.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free