Page 1 2 3 4 >>  
 

Java - Web Server

Pleaes remeber that each line should end with CRLF and also you need to send CRLF (\r\n or \015\012) after both request and response header.

OK, so you probably have an idea to how to write your own webserver...
Here's things I listed out as some of the necessary components.
1. Server Class - Main thread which is responsible to run other components
2. RequestHandler - A thred responsible for listening to incoming request
3. ContentProvider - Threads responsible for translating file locations
4. MimeTypeMap - Lookup table for file extensions and their associated mime type
5. Configuration - Lookup table for server configurations.

This is a very rough initial design, so there's more to come...

[Diagram]

Code:
  • AllContentHandler.java
  • Configuration.java
  • ConfigurationException.java
  • ContentHandler.java
  • ContentProvider.java
  • Error.java
  • ErrorHandler.java
  • HttpRequest.java
  • HttpServer.java
  • Request.java
  • RequestHandler.java


Continue

   
     
   
[contact][about me][disclaimer]