<commit_before>package igm.alsdb.controller;

import igm.alsdb.model.Download;
import igm.alsdb.util.DBManager;
import igm.alsdb.model.Input;
import igm.alsdb.model.Output;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Nick
 */
public class Search extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        try {
            if (Input.query == null
                    || !Input.query.equalsIgnoreCase(request.getParameter("query"))) {

                if (Download.rootPath == null) {
                    Download.rootPath = getServletContext().getRealPath("/download/");
                }

                DBManager.init();

                Input.init(request);

                Output.init();

                setRequest(request);

                request.getRequestDispatcher("browser.jsp").forward(request, response);
            }
        } catch (Exception ex) {
            request.getRequestDispatcher("error.jsp").forward(request, response);
        }
    }

    private void setRequest(HttpServletRequest request) {
        request.setAttribute("query", Input.query);
        request.setAttribute("table", Input.table);
        request.setAttribute("variant", Output.variant);
        request.setAttribute("variantList", Output.variantList);
        request.setAttribute("errorMsg", Output.errorMsg);
        request.setAttribute("url", Download.url);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {<commit_msg>contents updated<commit_after>package igm.alsdb.controller;

import igm.alsdb.model.Download;
import igm.alsdb.util.DBManager;
import igm.alsdb.model.Input;
import igm.alsdb.model.Output;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Nick
 */
public class Search extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        try {
            if (Input.query == null
                    || !Input.query.equalsIgnoreCase(request.getParameter("query"))) {

                if (Download.rootPath == null) {
                    Download.rootPath = getServletContext().getRealPath("/download/");
                }

                DBManager.init();

                Input.init(request);

                Output.init();
            }

            setRequest(request);

            request.getRequestDispatcher("browser.jsp").forward(request, response);
        } catch (Exception ex) {
            request.getRequestDispatcher("error.jsp").forward(request, response);
        }
    }

    private void setRequest(HttpServletRequest request) {
        request.setAttribute("query", Input.query);
        request.setAttribute("table", Input.table);
        request.setAttribute("variant", Output.variant);
        request.setAttribute("variantList", Output.variantList);
        request.setAttribute("errorMsg", Output.errorMsg);
        request.setAttribute("url", Download.url);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
{'fraction_non_alphanumeric': 0.10186335403726708, 'fraction_numerical': 0.0, 'mean_word_length': 2.8052930056710776, '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': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3425965', 'n_tokens_mistral': 984, 'n_tokens_neox': 969, 'n_words': 191}