I'm trying to make a web server. I connect to the the web server using IE, with a html page that has a form, and just output whatever IE sends to the command prompt. At the moment all I can get out is the http header. What I really want to do is get the form information back, then send a new page to the browser based on that info. This is the thread code that reads what IE sends and prints it out to the command prompt, then sends back a new page to the browser.
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String inputLine;
String HTTPResponseHeader = "HTTP/1.1 200 OK\nContent-Type: text/html\nContent-Length: ";
String htmlResponseMessage = "<html><form action=\" method=\"post\" enctype=\"text/plain\"><p><input type =\"submit\" value =\"Submit!\" /></p></form></html>";
while ((inputLine = in.readLine()).hashCode() != 0)
{
System.out.println(inputLine);
}
out.println(HTTPResponseHeader+htmlResponseMessage.length()+"\n\n"+htmlResponseMessage);
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String inputLine;
String HTTPResponseHeader = "HTTP/1.1 200 OK\nContent-Type: text/html\nContent-Length: ";
String htmlResponseMessage = "<html><form action=\" method=\"post\" enctype=\"text/plain\"><p><input type =\"submit\" value =\"Submit!\" /></p></form></html>";
while ((inputLine = in.readLine()).hashCode() != 0)
{
System.out.println(inputLine);
}
out.println(HTTPResponseHeader+htmlResponseMessage.length()+"\n\n"+htmlResponseMessage);