Netty 4: handling HTTP and HTTPS

I would like to handle HTTP connections on ports 80 and HTTPS on port 443 with a common handler.

I am currently creating two separate ServerBootstraps, ChannelInitializers share an instance of my handler, and one of them adds SslHandler to the pipeline.

Is there a better way to do this? If you use this way, can I share EventLoopGroups to reduce thread usage (I have quite a few concurrent connections)? Is there something I should note when doing this with OIO / NIO / AIO when using parent and child groups together?

Thank!

+3


source to share


1 answer


Yes, you can share EventLoops and maybe even do this. The rest of what you do is similar to the way out.



+2


source







All Articles