/*
 * $Id: HttpServer.java,v 1.1 2006/11/20 01:13:35 nishi Exp $
 * based on http://xxx.upken.jp/report/honey/http/
 */

package galatea.httpserver;


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Hashtable;


public class HttpServer {
	public void start(IHttpServerResponse r, int port) {
		Thread thread = new Thread(new HttpServerListenerProc(r, port));
		thread.start();
	}

	synchronized public static void addLogPrintLn(String str){
//		System.out.println(str);
	}

	synchronized public static void addLogPrint(String str){
//		System.out.print(str);
	}

	public static void main(String args[]){
		HttpServer sv = new HttpServer();
		int port = 9999;
		sv.start(new IHttpServerResponse() {
			public String getResponse(String path) {
				return "<h1>hello " + path + "</h1>";
			}
		}, port);
		while (true) {
			addLogPrintLn("Running");
			try {
				Thread.sleep(1000);
			} catch (Exception e) {
				//
			}
		}
	}
}


