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.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.simple.SimpleContainerFactory;
import org.glassfish.jersey.simple.SimpleServer;

public class Bench {

	public static final String BASE_URI = "http://0.0.0.0:8080/";
	
	public static void main(String[] args) throws IOException {
		final ResourceConfig rc = new ResourceConfig().packages("twopm.tech.bench.jaxrs");
		final SimpleServer server = SimpleContainerFactory.create(URI.create(BASE_URI), rc);
		Runtime.getRuntime().addShutdownHook(new Thread(() -> {
			try {
				server.close();
			} catch (IOException ex) {
				Logger.getLogger(Bench.class.getName()).log(Level.SEVERE, null, ex);
			}
		}));
	}

}
