The core part is designed to be as simple as possible. It comprises of two interfaces:
Connection
and
ConnectionHandler
.
Connection
represents
connection from other computers or services. Input and output
streams, sockets or any other decorations are available through it (see
adapt
of Adaptable
class).
ConnectionHandler
is a class that knows what to do with the supplied
Connection
.
SocketConnection
,
for instance, is a simple extension of
Connection
that introduces a socket into the picture - thus enabling the handler to interrogate it in order to
gather information about the client or the state of the connection.
Most of server's components are just implementations of ConnectionHandler . Examples are: MVCConnectionHandler (more will be explained later), Selector or HTTPServerConnectionHandler , ErrorConnectionHandler and ReadOnlyFileConnectionHandler .