import java.net.*;
import java.io.*;

/**
 * This class implements a simple HTTP webserver which supports both the 1.0 and 1.1 version of the protocol.
 * 
 * @author Sander Geijsen and Bavo Goosens.
 *
 */
public class WebServer implements Runnable{

	/**
	 * This variable holds port on which the server listens for incoming connections.
	 */
	private ServerSocket port;
	
	/**
	 * This method constructs the webserver and sets the listening port on the user supplied value.
	 * 
	 * @param port
	 * 		  An integer representing the port on which the server listens. 
	 */
	public WebServer(int port){
		try {
			this.setPort(new ServerSocket(port));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * This method starts the server.
	 */
	@Override
	public void run() {
		try {
			Socket connect = this.getPort().accept();
			BufferedReader clientin = new BufferedReader(
					new InputStreamReader(connect.getInputStream()));
			DataOutputStream clientout = new DataOutputStream(
					connect.getOutputStream());
			clientout.writeBytes(procesRequest(clientin.readLine()));
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

	private String procesRequest(String readLine) {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * 
	 * @return
	 */
	public ServerSocket getPort() {
		return port;
	}

	/**
	 * 
	 * @param port
	 */
	private void setPort(ServerSocket port) {
		this.port = port;
	}

}

@@ -12,16 +12,100 @@
 .net.*;%0A
+import java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;%0A
 import j
@@ -258,16 +258,27 @@
  Geijsen
+ (r0304675)
  and Bav
@@ -286,16 +286,27 @@
  Goosens
+ (r0297884)
 .%0A *%0A */
@@ -466,20 +466,95 @@
 rSocket 
-port
+listen_port;%0A%09%0A%09private Socket connection_port;%0A%09%0A%09private ExecutorService pool
 ;%0A%09%0A%09/**
@@ -822,24 +822,73 @@
 ket(port));%0A
+%09%09%09this.pool = Executors.newFixedThreadPool(40);%0A
 %09%09%7D catch (I
@@ -1024,29 +1024,35 @@
 ry %7B%0A%09%09%09
-Socket connec
+this.connection_por
 t = this
@@ -1151,24 +1151,32 @@
 ader(connect
+ion_port
 .getInputStr
@@ -1250,16 +1250,24 @@
 %09connect
+ion_port
 .getOutp
@@ -1303,22 +1303,22 @@
 teBytes(
-proces
+handle
 Request(
@@ -1329,19 +1329,19 @@
 ntin
-.readLine()
+, clientout
 ));%0A
@@ -1423,22 +1423,22 @@
 ing 
-proces
+handle
 Request(
 Stri
@@ -1437,77 +1437,247 @@
 est(
-String readLine) %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09return null
+BufferedReader clientin,%0A%09%09%09DataOutputStream clientout) %7B%0A%09%09String req = clientin.readLine();%0A%09%09if (isValidRequest(req))%7B%0A%09%09%09%0A%09%09%7D%0A%09%7D%0A%0A%09private boolean isValidRequest(String req) %7B%0A%09%09return req.matches(%22(GET%7CPUT%7CHEAD%7CPOST) .* HTTP/%5C%5Cd.%5C%5Cd%22)
 ;%0A%09%7D
@@ -1747,16 +1747,23 @@
 %09return 
+listen_
 port;%0A%09%7D
@@ -1845,16 +1845,23 @@
 %0A%09%09this.
+listen_
 port = p

switch it up