import java.util.*;
import java.io.*;

public class LocalServer extends HttpServer {
    public static void main(String[] args) {
        new LocalServer();
    }

    public String action(String filename, Hashtable vars) {
         String realfile=filename;
         // here we see if there is filename query 
         // variable -- if there is, we assume
         // this is really the "CGI" file
         if (vars.containsKey("Filename")) {
             try {
                 int items=0;
                 FileWriter fw = 
                     new FileWriter((String)vars.get("Filename"),true);
                 vars.remove("Filename");
                 Enumeration e=vars.keys();
                 while (e.hasMoreElements()) {
                     if (items++!=0) fw.write(",");
                     Object k=e.nextElement();
                     fw.write("\""+k+"\"=\"" + vars.get(k) + "\"");
                 }
                 fw.write('\n');
                 fw.close();
             } catch (IOException e) {
                 realfile="error.htm";
             }
         } 
         else
             realfile="/response.htm";
         return realfile;
    }
}
    
