public override void handleGETRequest(HttpProcessor p)
        {
            // right now we just render status onto any URL
            p.writeSuccess();
            StreamWriter s = p.outputStream;

            s.WriteLine("<html><body> <h1> StepsDB Server Status <h1> \n");
            s.WriteLine("<p>");
            s.WriteLine("<table border=1>\n");
            s.WriteLine(String.Format("<tr><td>Working Segment Size</td><td>{0}</td></tr>\n", raw_db.workingSegmentSize()));
            s.WriteLine("<tr><td>Segments</td><td>\n");

            // write out list of all segments
            {
                s.WriteLine("<table border=1>\n");
                foreach (var segment in raw_db.listAllSegments()) {
                    s.WriteLine(String.Format("<tr><td>{0}</td><Td>{1}</td></tr>\n", segment.start_key, segment.end_key));
                }
                s.WriteLine("</table>\n");
            }

            s.WriteLine("</table>\n");
        }
        public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData)
        {
            Console.WriteLine("POST request: {0}", p.http_url);
            string data = inputData.ReadToEnd();

            p.outputStream.WriteLine("<html><body><h1>test server</h1>");
            p.outputStream.WriteLine("<a href=/test>return</a><p>");
            p.outputStream.WriteLine("postbody: <pre>{0}</pre>", data);
        }
        public override void handleGETRequest(HttpProcessor p)
        {
            Console.WriteLine("request: {0}", p.http_url);
            p.writeSuccess();
            p.outputStream.WriteLine("<html><body><h1>test server</h1>");
            p.outputStream.WriteLine("Current Time: " + DateTime.Now.ToString());
            p.outputStream.WriteLine("url : {0}", p.http_url);

            p.outputStream.WriteLine("<form method=post action=/form>");
            p.outputStream.WriteLine("<input type=text name=foo value=foovalue>");
            p.outputStream.WriteLine("<input type=submit name=bar value=barvalue>");
            p.outputStream.WriteLine("</form>");
        }
 public void listen()
 {
     listener = new TcpListener(IPAddress.Any, port);
     listener.Start();
     while (is_active) {
         TcpClient s = listener.AcceptTcpClient();
         HttpProcessor processor = new HttpProcessor(s, this);
         Thread thread = new Thread(new ThreadStart(processor.process));
         thread.Start();
         Thread.Sleep(1);
     }
 }
 public abstract void handlePOSTRequest(HttpProcessor p, StreamReader inputData);
 public abstract void handleGETRequest(HttpProcessor p);
Beispiel #7
0
        public override void handlePOSTRequest(HttpProcessor p, System.IO.StreamReader inputData)
        {
            // if we put an empty message to a url, it's a request to create that database

            throw new NotImplementedException();
        }
Beispiel #8
0
        public override void handleGETRequest(HttpProcessor p)
        {
            //

            throw new NotImplementedException();
        }
 public override void handlePOSTRequest(HttpProcessor p, System.IO.StreamReader inputData)
 {
     throw new NotImplementedException();
 }