<commit_before>package org.ovirt.engine.core.services;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

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

import org.apache.log4j.Logger;

import org.ovirt.engine.core.utils.PKIResources;

public class PKIResourceServlet extends HttpServlet {

    private static final Logger log = Logger.getLogger(PKIResourceServlet.class);

    private static Map<String, PKIResources.Resource> resources;
    private static Map<String, PKIResources.OutputType> formats;
    private transient PKIResources pkiResources;

    static {
        resources = new HashMap<String, PKIResources.Resource>();
        resources.put("ca-certificate", PKIResources.Resource.CACertificate);
        resources.put("engine-certificate", PKIResources.Resource.EngineCertificate);
        formats = new HashMap<String, PKIResources.OutputType>();
        formats.put("X509-PEM", PKIResources.OutputType.X509_PEM);
        formats.put("X509-PEM-CA", PKIResources.OutputType.X509_PEM_CA);
        formats.put("OPENSSH-PUBKEY", PKIResources.OutputType.OPENSSH_PUBKEY);
    }

    private String getMyParameter(String name, HttpServletRequest request) {
        String value;

        value = request.getParameter(name);
        if (value == null) {
            value = (String)request.getAttribute(name);
        }
        if (value == null) {
            value = getInitParameter(name);
        }
        return value;
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        pkiResources = PKIResources.getInstance();
    }

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

        PKIResources.OutputType outputType = null;

        String resource = getMyParameter("resource", request);
        String format = getMyParameter("format", request);
        String alias = getMyParameter("alias", request);<commit_msg>services: pki-resources: cleanup: use servlet init() instead of init(config)<commit_after>package org.ovirt.engine.core.services;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

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

import org.apache.log4j.Logger;

import org.ovirt.engine.core.utils.PKIResources;

public class PKIResourceServlet extends HttpServlet {

    private static final Logger log = Logger.getLogger(PKIResourceServlet.class);

    private static Map<String, PKIResources.Resource> resources;
    private static Map<String, PKIResources.OutputType> formats;
    private transient PKIResources pkiResources;

    static {
        resources = new HashMap<String, PKIResources.Resource>();
        resources.put("ca-certificate", PKIResources.Resource.CACertificate);
        resources.put("engine-certificate", PKIResources.Resource.EngineCertificate);
        formats = new HashMap<String, PKIResources.OutputType>();
        formats.put("X509-PEM", PKIResources.OutputType.X509_PEM);
        formats.put("X509-PEM-CA", PKIResources.OutputType.X509_PEM_CA);
        formats.put("OPENSSH-PUBKEY", PKIResources.OutputType.OPENSSH_PUBKEY);
    }

    private String getMyParameter(String name, HttpServletRequest request) {
        String value;

        value = request.getParameter(name);
        if (value == null) {
            value = (String)request.getAttribute(name);
        }
        if (value == null) {
            value = getInitParameter(name);
        }
        return value;
    }

    @Override
    public void init() throws ServletException {
        pkiResources = PKIResources.getInstance();
    }

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

        PKIResources.OutputType outputType = null;

        String resource = getMyParameter("resource", request);
        String format = getMyParameter("format", request);
        String alias = getMyParameter("alias", request);
{'fraction_non_alphanumeric': 0.09766797506349573, 'fraction_numerical': 0.006003232509812976, 'mean_word_length': 3.734426229508197, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2282750', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1165, 'n_words': 249}