package jcsi;

import java.util.Properties;
import java.io.File;
import com.sun.web.core.*;
import com.sun.web.server.*;
import java.net.*;

public class WebServer
{
  public static void main(String[] args) 
  {
    int port = 8000;
    HttpServer server = new HttpServer(port, null, null);

    try 
    {
      String pwd = System.getProperty("user.dir");
      URL url = new URL("file", null, pwd + "/" + "webpages");
      server.setDocumentBase(url);
      server.setTempDir(new File(pwd + "/" + "work"));
      System.out.println("Starting with docbase of: " + url);
      System.out.println(server.getServerInfo());
      server.start();
    } 
    catch (MalformedURLException mue) 
    {
      System.out.println("Malformed URL Exception for doc root");
      System.out.println(mue.getMessage());
    } 
    catch (HttpServerException hse) 
    {
      System.out.println("Server threw an exception while running");
      System.out.println(hse.getMessage());
    }
  }
}
