public void run() {
			try {
				in = new BufferedReader(new InputStreamReader(
						socket.getInputStream()));
				output = new DataOutputStream(socket.getOutputStream());
				String line, path = root;
				int method = 0;
				while ((line = in.readLine()) != null) {
					String temp = line.toUpperCase();
					if (temp.startsWith("GET")) {
						method = 1;
						String p = line.split(" ")[1];
						path = root + (root.endsWith("/") ? p.substring(1) : p);
					} else if (temp.startsWith("HEAD"))
						method = 2;
					if (method == 0) {
						onError(this, 501);
						return;
					}
					File file = new File(clean(path));
					String[] f = file.getName().split("\\.");
					if (!file.exists()) {
						onError(this, 404);
						return;
					}
					if (method == 1) {
						setHeader(200, "." + f[f.length - 1]);
						writeFile(file);
					}
					return;
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}