main() — netty Function Reference
Architecture documentation for the main() function in Http2StaticFileServer.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 8acefdad_8fa6_0373_cf11_bea0061b04eb["main()"] 89c46614_0cc8_c5f4_216b_ecdf8653e636["Http2StaticFileServer"] 8acefdad_8fa6_0373_cf11_bea0061b04eb -->|defined in| 89c46614_0cc8_c5f4_216b_ecdf8653e636 style 8acefdad_8fa6_0373_cf11_bea0061b04eb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/http2/file/Http2StaticFileServer.java lines 40–75
public static void main(String[] args) throws Exception {
X509Bundle ssc = new CertificateBuilder()
.subject("cn=localhost")
.setIsCertificateAuthority(true)
.buildSelfSigned();
SslContext sslCtx = SslContextBuilder.forServer(ssc.toKeyManagerFactory())
.sslProvider(SslProvider.JDK)
.ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
.applicationProtocolConfig(new ApplicationProtocolConfig(
ApplicationProtocolConfig.Protocol.ALPN,
// NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,
// ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT,
ApplicationProtocolNames.HTTP_2,
ApplicationProtocolNames.HTTP_1_1))
.build();
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
try {
ServerBootstrap b = new ServerBootstrap();
b.group(group)
.channel(NioServerSocketChannel.class)
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new Http2StaticFileServerInitializer(sslCtx));
Channel ch = b.bind(PORT).sync().channel();
System.out.println("Open your web browser and navigate to https://127.0.0.1:" + PORT + '/');
ch.closeFuture().sync();
} finally {
group.shutdownGracefully();
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does main() do?
main() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http2/file/Http2StaticFileServer.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/http2/file/Http2StaticFileServer.java at line 40.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free