Class HttpFileServer

All Implemented Interfaces:
Runnable, EventSubscriber, Fiber.Worker

public class HttpFileServer extends HttpSession
A simple file server over http Usage: Run java kilim.examples.HttpFileServer [base directory name] From a browser, go to "http://localhost:7262". A HttpFileServer object is a SessionTask, and is thus a thin wrapper over the socket connection. Its execute() method is called once on connection establishment. The HttpRequest and HttpResponse objects are wrappers over a bytebuffer, and unrelated to the socket. The request object is "filled in" by HttpSession.readRequest() and the response object is sent by HttpSession.sendResponse(). The rest of the code is related to the mechanics of file serving, common to Kilim and non-Kilim approaches alike. The objective of this example is merely to demonstrate Kilim API, not to have a fully functioning file server.