package com.brunobasto.ebnf.server;

import java.io.File;

import javax.servlet.ServletException;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Tomcat;
import org.apache.naming.resources.VirtualDirContext;
public class Launcher {

	public static void main(String[] args) {
		int port = 80;

		if (args.length > 0) {
			port = Integer.valueOf(args[0]);
		}

		String webappDirLocation = "docroot/";

		Tomcat tomcat = new Tomcat();
		tomcat.setPort(port);
		tomcat.setBaseDir(new File("tomcat").getAbsolutePath());

		String path = new File(webappDirLocation).getAbsolutePath();

		try {
			StandardContext ctx = (StandardContext)tomcat.addWebapp("/", path);

			VirtualDirContext resources = new VirtualDirContext();

			resources.setExtraResourcePaths(
				"/WEB-INF/classes=" + new File("classes")
			);

			ctx.setResources(resources);

			tomcat.start();
		}
		catch (ServletException se) {
			se.printStackTrace();
		}
		catch (LifecycleException le) {
			le.printStackTrace();
		}

		tomcat.getServer().await();
	}

}
@@ -594,16 +594,378 @@
 th());%0A%0A
+%09%09Connector connector = this.current.getConnector();%0A%09%09connector.setProperty(%0A%09%09%09%22compressableMimeType%22, %22text/html,text/xml, text/css,%22 +%0A%09%09%09%22application/json, application/javascript%22);%0A%09%09connector.setProperty(%22compression%22, %22on%22);%0A%09%09connector.setProperty(%22compressionMinSize%22, %221024%22);%0A%09%09connector.setProperty(%22noCompressionUserAgents%22, %22gozilla, traviata%22);%0A%0A
 %09%09String

Enable gzip compression