<commit_before>package com.ctrip.zeus.crossdomain;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by lu.wang on 2016/6/16.
 */
public class CrossDomainFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
        final HttpServletRequest request = (HttpServletRequest) servletRequest;
        final HttpServletResponse response = (HttpServletResponse) servletResponse;

        String origin = request.getHeader(HeaderUtil.ORIGIN);
        if (origin != null) {
            // Client request header contains the origin header
            response.setHeader(HeaderUtil.ALLOW_ORIGIN, origin);
            String requestMethod = request.getHeader(HeaderUtil.REQUEST_METHOD);
            String requestHeaders = request.getHeader(HeaderUtil.REQUEST_HEADERS);
            if (request.getMethod().equals(HeaderUtil.OPTIONS_METHOD) && (requestMethod != null || requestHeaders != null)) {
                response.setHeader(HeaderUtil.ALLOW_HEADERS, requestHeaders);
                response.setHeader(HeaderUtil.ALLOW_METHODS, requestMethod);
                response.setHeader(HeaderUtil.ALLOW_CREDENTIALS, HeaderUtil.HeaderValues.ALLOW_CREDENTIALS_TRUE);
            }
        }
        filterChain.doFilter(request,response);
    }

    @Override
    public void destroy() {

    }
}
<commit_msg>fix cross domain error<commit_after>package com.ctrip.zeus.crossdomain;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by lu.wang on 2016/6/16.
 */
public class CrossDomainFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
        final HttpServletRequest request = (HttpServletRequest) servletRequest;
        final HttpServletResponse response = (HttpServletResponse) servletResponse;

        String origin = request.getHeader(HeaderUtil.ORIGIN);
        if (origin != null) {
            // Client request header contains the origin header
            response.setHeader(HeaderUtil.ALLOW_ORIGIN, origin);
            response.setHeader(HeaderUtil.ALLOW_CREDENTIALS, HeaderUtil.HeaderValues.ALLOW_CREDENTIALS_TRUE);

            String requestMethod = request.getHeader(HeaderUtil.REQUEST_METHOD);
            String requestHeaders = request.getHeader(HeaderUtil.REQUEST_HEADERS);
            if (request.getMethod().equals(HeaderUtil.OPTIONS_METHOD) && (requestMethod != null || requestHeaders != null)) {
                response.setHeader(HeaderUtil.ALLOW_HEADERS, requestHeaders);
                response.setHeader(HeaderUtil.ALLOW_METHODS, requestMethod);
            }
        }
        filterChain.doFilter(request, response);
    }

    @Override
    public void destroy() {

    }
}

{'fraction_non_alphanumeric': 0.0829077801141484, 'fraction_numerical': 0.004205467107239411, 'mean_word_length': 3.487870619946092, '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': '4669289', 'n_tokens_mistral': 860, 'n_tokens_neox': 839, 'n_words': 184}