<commit_before>package org.zanata.magpie.servlet;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import javax.annotation.Nullable;
import javax.annotation.Priority;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Priorities;

import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.StringUtils;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import org.apache.http.client.utils.URIBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.zanata.magpie.api.APIConstant.ORIGIN_WHITELIST;
import static org.zanata.magpie.servlet.APISecurityFilter.API_PATH;

/**
 * This filter is for REST API requests.
 * It supports <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS">
 * Cross-Origin resource sharing (CORS)</a> by adding {@code Access-Control}
 * headers to REST responses. CORS is needed for requests from different
 * domains.
 *
 * This is needed if API call is triggered from browser from different domains.
 *
 * @author <NAME> <a href="mailto:<EMAIL>"><EMAIL></a>
 */
@WebFilter(filterName = "APIResponseFilter", value = { API_PATH + "*" })
@Priority(Priorities.HEADER_DECORATOR)
public class APIResponseFilter implements Filter {
    private static final String ALLOW_METHODS =<commit_msg>fix compilation after merge<commit_after>package org.zanata.magpie.servlet;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import javax.annotation.Nullable;
import javax.annotation.Priority;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Priorities;

import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.StringUtils;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import org.apache.http.client.utils.URIBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.zanata.magpie.api.APIConstant.API_CONTEXT;
import static org.zanata.magpie.api.APIConstant.ORIGIN_WHITELIST;

/**
 * This filter is for REST API requests.
 * It supports <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS">
 * Cross-Origin resource sharing (CORS)</a> by adding {@code Access-Control}
 * headers to REST responses. CORS is needed for requests from different
 * domains.
 *
 * This is needed if API call is triggered from browser from different domains.
 *
 * @author <NAME> <a href="mailto:<EMAIL>"><EMAIL></a>
 */
@WebFilter(filterName = "APIResponseFilter", value = { "/" + API_CONTEXT + "/*" })
@Priority(Priorities.HEADER_DECORATOR)
public class APIResponseFilter implements Filter {
    private static final String ALLOW_METHODS =
{'fraction_non_alphanumeric': 0.1074992871400057, 'fraction_numerical': 0.001710863986313088, 'mean_word_length': 5.824902723735408, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '6961930', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1036, 'n_words': 241}