If you've ever wondered how a web server works, this example should be
of interest to you; it's a skeletal web server written in Java. It can only
handle HTML documents at present (no GIFs or CGIs). It is not intended to
be used as a production web server. Let me repeat that: It is not intended
to be used as a production web server. But if you've ever had the urge
to tinker around with the innards of a web server, but feel put off by the
reams of source code that a typical web server entails, this might be
a gentler introduction.
For a slightly longer, but more full-featured example of a minimalist
web server written in Perl, check out
tinyhttpd.pl
The source:TeenyWeb.java