<commit_before>package ecologylab.bigsemantics.service;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;

/**
 * Glues different components of the service together.
 * 
 * @author quyin
 */
public class ServiceApplication
{
  
  public static class HelloServlet extends HttpServlet
  {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
      resp.setContentType("text/html");
      resp.getWriter().println("Hello world!");
      resp.setStatus(HttpServletResponse.SC_OK);
    }

  }


  public static void main(String[] args)
  {
    // set up jersey servlet
    ResourceConfig config = new ResourceConfig();
    config.packages("ecologylab.bigsemantics.service"); // resource scanning
    ServletContainer container = new ServletContainer(config);

    // set up jetty handler for servlets
    ServletContextHandler handler = new ServletContextHandler();
    handler.setContextPath("/");
    handler.addServlet(new ServletHolder(new HelloServlet()), "/hello");
//    handler.addServlet(new ServletHolder(container), "/BigSemanticsService/*");

    // set up jetty server components
    QueuedThreadPool threadPool = new QueuedThreadPool(500, 50);
    Server server = new Server(threadPool);
    // num of acceptors: num of cores - 1
    // num of selectors: use default guess. in practice, depend on cores, load, etc.
    int cores = Runtime.getRuntime().availableProcessors();
    ServerConnector connector = new ServerConnector(server, cores - 1, -1);
    connector.setPort(8080);
    server.addConnector(connector);

    // misc server settings
    server.setStopAtShutdown(true);

    // connect handler to server
    server.setHandler(handler);

    // run server
    try
    {
      server.start();
      server.join();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }

}
<commit_msg>Now BSService loads as a jar.<commit_after>package ecologylab.bigsemantics.service;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;

/**
 * Glues different components of the service together.
 * 
 * @author quyin
 */
public class ServiceApplication
{
  
  public static class HelloServlet extends HttpServlet
  {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
      resp.setContentType("text/html");
      resp.getWriter().println("Hello world!");
      resp.setStatus(HttpServletResponse.SC_OK);
    }

  }


  public static void main(String[] args)
  {
    // set up jersey servlet
    ResourceConfig config = new ResourceConfig();
    config.packages("ecologylab.bigsemantics.service"); // resource scanning
    ServletContainer container = new ServletContainer(config);

    // set up jetty handler for servlets
    ServletContextHandler handler = new ServletContextHandler();
    handler.setContextPath("/");
    handler.addServlet(new ServletHolder(new HelloServlet()), "/hello");
    handler.addServlet(new ServletHolder(container), "/BigSemanticsService/*");

    // set up jetty server components
    QueuedThreadPool threadPool = new QueuedThreadPool(500, 50);
    Server server = new Server(threadPool);
    // num of acceptors: num of cores - 1
    // num of selectors: use default guess. in practice, depend on cores, load, etc.
    int cores = Runtime.getRuntime().availableProcessors();
    ServerConnector connector = new ServerConnector(server, cores - 1, -1);
    connector.setPort(8080);
    server.addConnector(connector);

    // misc server settings
    server.setStopAtShutdown(true);

    // connect handler to server
    server.setHandler(handler);

    // run server
    try
    {
      server.start();
      server.join();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }

}

{'fraction_non_alphanumeric': 0.10202814569536424, 'fraction_numerical': 0.004966887417218543, 'mean_word_length': 3.828171828171828, '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': '5456428', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1318, 'n_words': 325}