The core module contains the main classes that allows the HTTP server implementation to run.
The HTTP server implementation is based on pure NIO APIs based on The Rox Java NIO Tutorial; while read/write operations are managed via built-in Selector, a multi-thread executor handles the HTTP protocol for each client-server messages exchange.
A detailed UML class diagram will help to understand the model design.
The SimpleHttpServer handles client requests incrementally via the pull parser RequestStreamingParser; once the Request has been completely interpreted, the SimpleHttpServer delegates the ProtocolProcessor, executed in a separated thread, the HTTP protocol management, that via the RequestDispatcher addresses the Request to the right RequestHandler; the SessionManager is the entity responsible to manage the request Session lifecycle.
Once the Reponse is complete and ready to be streamed to the client, the ResponseSerializer will take care of build the reponse message in the channel.
The RequestStreamingParser is a Request pull parser that builds incoming clients requests messages incrementally; it doesn't rely on inefficient regexp - and could not, due to the nature of pull parser - but it instead a state machine that implements (a simplified version, of course) of an LL(0) interpreter.
A detailed UML class diagram will help to understand the model design.
Model is very simple: the RequestStreamingParser, depending on the current analyzing character, due to its nature of state-machine, assumes different ParserStatus value; each time a token is recognized, a ParserTrigger is invoked and, once updated the Request, updates the RequestStreamingParser status.
The Parser Triggers UML class diagram shows how any ParserTrigger reflects part of the incoming Request that is built incrementally.
A special case is for non application/x-www-form-urlencoded request bodies, that are not managed by any handler, but rather just collects sent bytes by clients in a sequence of ByteBuffer.