package twopm.tech.bench.jaxrs;

import java.io.IOException;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.jetty.server.Server;
import org.glassfish.jersey.jetty.JettyHttpContainerFactory;
import org.glassfish.jersey.server.ResourceConfig;

public class Bench {

	public static final String BASE_URI = "http://0.0.0.0:8080/";

	public static void main(String[] args) throws IOException, Exception {
		final ResourceConfig rc = new ResourceConfig().packages("twopm.tech.bench.jaxrs");
		final Server server = JettyHttpContainerFactory.createServer(URI.create(BASE_URI), rc);
		Runtime.getRuntime().addShutdownHook(new Thread(() -> {
			try {
				server.stop();
			} catch (Exception ex) {
				Logger.getLogger(Bench.class.getName()).log(Level.SEVERE, null, ex);
			}
		}));
		server.start();
	}

}
