import import java.net.*;
import java.io.*;
import java.util.*;
class declaration public class httpServer
{
global variables String DocumentRoot = "/web/edu/topics/java/server/web";
int port = 81;
main method public static void main(String args[])
{
   httpServer h = new httpServer();
   h.startIt();
}
methods public void startIt()
{
  try{
    ServerSocket sso=new ServerSocket(port);
    System.out.println("Java httpd awaiting socket connections on port "+port);
    while(true){
       Socket so=sso.accept();
       new httpHandler(so,DocumentRoot).start();
    }
  }
  catch(Exception e){
    System.out.println("ServerSocket exception: "+e);
  }
}
threads class httpHandler extends Thread {

 

variables inside a httpHandler object Socket so;
String PrependingPath = null;

httpHandler(Socket so, String DocumentRoot){
    this.so=so;
    this.PrependingPath = DocumentRoot;
}
DataInputStream
StringTokenizer
FileInputStream
HTTP if(s!=null && s.startsWith("POST ")){
   post=true;
}
Response dos.writeBytes(header);
dos.write(buf);
dos.flush();