<commit_before>package fr.epsi.i4.bookmark;

import java.io.IOException;
import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;
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.SimpleContainerProvider;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import org.simpleframework.http.core.Container;

import fr.epsi.i4.bookmark.web.BookmarkApplication;

public class Main implements Container {

	private Container container;
	
	public Main() {
		SimpleContainerProvider provider = new SimpleContainerProvider();
		container = provider.createContainer(Container.class, new BookmarkApplication());
	}

	public static void main(String[] args) throws URISyntaxException {
		String port = Objects.toString(System.getenv("PORT"), "8080");
        Logger.getLogger("bookmarks").log(Level.INFO, "Starting web services on port " + port);
		SimpleContainerFactory.create(new URI("http://rest-bookmarks.herokuapp.com:" + 8080), ResourceConfig.forApplication(new BookmarkApplication()));
	}

	@Override
	public void handle(Request request, Response response) {
		if (request.getPath().getPath().equals("/")) {
			if (request.getMethod().equals("GET")) {
				response.setContentType("text/html");
				try(PrintStream printStream = response.getPrintStream()) {
					printStream.println("Hello");
				} catch (IOException e) {
					e.printStackTrace();
				}<commit_msg>using alternate way to start server<commit_after>package fr.epsi.i4.bookmark;

import java.io.IOException;
import java.io.PrintStream;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.glassfish.jersey.simple.SimpleContainerProvider;
import org.simpleframework.http.Request;
import org.simpleframework.http.Response;
import org.simpleframework.http.core.Container;
import org.simpleframework.http.core.ContainerServer;
import org.simpleframework.transport.Server;
import org.simpleframework.transport.connect.Connection;
import org.simpleframework.transport.connect.SocketConnection;

import fr.epsi.i4.bookmark.web.BookmarkApplication;

public class Main implements Container {

	private Container container;
	
	public Main() {
		SimpleContainerProvider provider = new SimpleContainerProvider();
		container = provider.createContainer(Container.class, new BookmarkApplication());
	}

	public static void main(String[] args) throws IOException, InterruptedException {
		int port = Integer.parseInt(Objects.toString(System.getenv("PORT"), "8080"));
        Logger.getLogger("bookmarks").log(Level.INFO, "Starting web services on port " + port);
        Server server = new ContainerServer(new Main());

		try(Connection connection = new SocketConnection(server)) {
			SocketAddress address = new InetSocketAddress(port);
			connection.connect(address);
			synchronized (connection) {
				connection.wait();
			}
		}
	}

	@Override
	public void handle(Request request, Response response) {
		if (request.getPath().getPath().equals("/")) {
			if (request.getMethod().equals("GET")) {
				response.setContentType("text/html");
				try(PrintStream printStream = response.getPrintStream()) {
					printStream.println("Hello");
				} catch (IOException e) {
					e.printStackTrace();
				}
{'fraction_non_alphanumeric': 0.11858608893956671, 'fraction_numerical': 0.004561003420752566, 'mean_word_length': 5.438532110091743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3215236', 'n_tokens_mistral': 1050, 'n_tokens_neox': 959, 'n_words': 204}