This HTTP server was written in Java over the course of 2 months under the guidance of Professor Grimm. It is a mix of HTTP 1.0 and 1.1 compliance, but does function correctly with all major web browsers. To serve concurrent requests, it calls upon a pool of ClientHandler threads. Each ClientHandler thread lays dormant until woken up by the primary accept-loop thread. The ClientHandler thread reads the request out of the TCP/IP socket and passes the request to its sister thread: ClientResponder. ClientResponder fetches the file and returns the data in fragments (set to 1Kb). Having separate ClientHandler and ClientResponder threads allows for pipelining of HTTP requests (the server can continue to queue up requests while simultaneously responding to previous ones). The server uses an LRU cache to store frequently used files in main memory to save on slow disk accesses. MIME Types are stored in an external config file and are handled internally by a HashMap, which is keyed by the file extension of the requested file (html, mpg, mp3, etc.).


Archive of JServer Source - (Zip Archive of Java Source Code, 8k)

Server output while handling requestsRequesting a page from http://localhost:2000
© Chris Harrison