sendListing() — netty Function Reference
Architecture documentation for the sendListing() function in Http2StaticFileServerHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d930130d_166e_d545_8a2f_33a40d608cd0["sendListing()"] 0106d702_a5aa_70a0_2d44_3e8c79971862["Http2StaticFileServerHandler"] d930130d_166e_d545_8a2f_33a40d608cd0 -->|defined in| 0106d702_a5aa_70a0_2d44_3e8c79971862 f3d3a002_604b_1387_a2bd_93edd96b6d76["channelRead()"] f3d3a002_604b_1387_a2bd_93edd96b6d76 -->|calls| d930130d_166e_d545_8a2f_33a40d608cd0 style d930130d_166e_d545_8a2f_33a40d608cd0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/http2/file/Http2StaticFileServerHandler.java lines 251–297
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);
Http2Headers headers = new DefaultHttp2Headers();
headers.status(OK.toString());
headers.add(HttpHeaderNames.CONTENT_TYPE, "text/html; charset=UTF-8");
ctx.write(new DefaultHttp2HeadersFrame(headers).stream(stream));
ctx.writeAndFlush(new DefaultHttp2DataFrame(buffer, true).stream(stream));
}
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/http2/file/Http2StaticFileServerHandler.java.
Where is sendListing() defined?
sendListing() is defined in example/src/main/java/io/netty/example/http2/file/Http2StaticFileServerHandler.java at line 251.
What calls sendListing()?
sendListing() is called by 1 function(s): channelRead.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free