package com.newinternaldsp;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		System.out.println("Internal DSP Service Started");
		Server server = new Server(8080);

//Create a ServletContextHandler
		ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
//context.setContextPath("/test");

//Add Jersey servlet to the context
		ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/api/*");
		jerseyServlet.setInitOrder(0);
		jerseyServlet.setInitParameter("jersey.config.server.provider.packages", "com.newinternaldsp.Controller");

//Set the context for the server
		server.setHandler(context);

		try {
			// Start the server
			server.start();
			server.join();
		} finally {
			// Stop the server when the application exits
			server.destroy();
		}
	}

}
