package com.haxademic.core.net;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;

import org.eclipse.jetty.server.Server;

import com.haxademic.core.app.P;
import com.haxademic.core.file.FileUtil;

import processing.core.PImage;

public class WebServer {
	
	public static boolean DEBUG;
	public static int PORT = 8080;
	protected WebServerRequestHandler handler;

	public WebServer(WebServerRequestHandler handler, boolean debug) {
		WebServer.DEBUG = debug;
		this.handler = handler;
		
		new Thread(new Runnable() { public void run() {
			initWebServer();
		}}).start();	
	}
	
	protected void initWebServer() {
        Server server = new Server(WebServer.PORT);
        server.setHandler(this.handler);        

        // start the server!
        try {
			server.start();
			server.join();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static String getServerAddress() {
		String serverBase = "";
		InetAddress addr;
		try {
			addr = InetAddress.getLocalHost();
			// Get IP Address
			byte[] ipAddr = addr.getAddress();
			// Get hostname
			String hostname = addr.getHostName();
			serverBase = "http://" + addr.getHostAddress() + ":" + WebServer.PORT + "/";
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
		return serverBase;
	}

}

@@ -96,36 +96,8 @@
 ion;
-%0Aimport java.util.ArrayList;
 %0A%0Aim
@@ -139,115 +139,8 @@
 r;%0A%0A
-import com.haxademic.core.app.P;%0Aimport com.haxademic.core.file.FileUtil;%0A%0Aimport processing.core.PImage;%0A%0A
 publ
@@ -918,16 +918,19 @@
 ress%0A%09%09%09
+// 
 byte%5B%5D i
@@ -978,16 +978,19 @@
 name%0A%09%09%09
+// 
 String h

Fix warnings