In the last lesson we created a do-it-yourself rpc framework, in this lesson we challenge ourselves to a slightly more difficult task, to create a web framework manually.
I don't really want to call it an MVC framework, because I didn't think about how MVC it was going to be when I made this little project, everything was aimed at being easy to use.
First let's see how easy this web framework is to use
is a request dispatcher that is used to throw the received HTTP request object to the responding one for processing.
Used to build routes, what it is responsible for is taking URL rules and hooking them up to form a complex mapping table.
To simplify the implementation details, so there is no support for complex URL rules, such as this form of writing parameters inside URLs like this one is not supported.
It is the core object of the web server, and there are 3 key parameters that need to be provided to build the HttpServer in addition to the IP port, which are the number of IO threads, the number of business threads, and the request dispatcher object. IO threads are used to handle kit word reads and writes and are managed internally by Netty. The business thread is dedicated to handling HTTP requests and is managed by the httpkids framework.
A comprehensive example