@Override
	public void process(InputStream input, OutputStream outputStream) throws IOException 
	{
		PrintWriter out = new PrintWriter(outputStream, true);
		BufferedReader in = new BufferedReader(new InputStreamReader(
				input));
		
		String firstLine = in.readLine();
		if (firstLine == null) {
			return;
		}
		try{
			GetRequest request = GetParser.parseGetLine(firstLine);
			
		if (request.requestedFile.equals("/"))
		{
			request.requestedFile = "index.html";
		}
		File file = new File(httpdConfiguration.getHttpDocuments()
				.getAbsolutePath()
				+ File.separator
				+ request.requestedFile);
		if (file.exists() && file.isFile()) {
			
			out.write(Code200.getMessage() + "\n");
			out.write("Accept-Ranges: bytes\n");
			out.write("Content-Length: " + file.length() + "\n");
			out.write("Connection: close\n");
			if (file.getName().endsWith(".html"))
			{
				PlainTextWriter writer = new PlainTextWriter(file);
				writer.process(out);
			} else if (file.getName().endsWith(".png"))
			{
				BinaryFileWriter writer = new BinaryFileWriter(file);
				writer.process(out, "image/png");
			}
		} else {
			out.write(Code404.getMessage() + "\n\n");
		}
		} catch(IllegalArgumentException ex)
		{
			out.write(Code400.getMessage() + "\n\n");
		}
		out.flush();
	}