The requirement is (from thejesh’s portal techmag.biz)
Let us write a simple web server in Java.The purpose is learning. A webserver listens at a given port and gives back the file asked (request). Here only http requests are considered.
Let us keep it simple and serve only HTML pages and not GIF’s and JPEG’s.Points to consider:
(1) The server will to on a port. By default all the web servers listen to port 80. We are allowed to use other ports unless it is used by other process.
(2) Every webserver will have a root folder. Only the files under this root folder are accessible by the server.
(3) We will serve only .htm or .html files
(4) When we get the request. the first line of the request will contain the word “GET” followed by the file name.
(5) The server should be multithreaded to handle multiple requests.
(6) The first line of the response will be “HTTP/1.0 200 OK”
(7) The second line of the response contains “Content-type: text\html”
(8) The content of the requested fil follows next.
The Java code: Its in process. Now Version 0.2 (Released under GNU GPL) Continue reading ‘Java Webserver inspired from Thejesh’
Recent Comments