<commit_before>package org.opentosca.containerapi;

import java.io.IOException;

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.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CorsFilter implements Filter {
	
	
	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		HttpServletRequest req = (HttpServletRequest) request;
		HttpServletResponse res = (HttpServletResponse) response;
		
		if (req.getHeader("Origin") != null) {
			res.addHeader("Access-Control-Allow-Origin", "*");
			res.addHeader("Access-Control-Expose-Headers", "Origin, Content-Type, X-Cache-Date, Location");
		}
		
		if ("OPTIONS".equals(req.getMethod())) {
			res.addHeader("Access-Control-Allow-Methods", "OPTIONS, GET, POST");
			res.addHeader("Access-Control-Allow-Headers", "Origin, Content-Type, X-Cache-Date, Location");
			res.addHeader("Access-Control-Max-Age", "-1");
		}
		chain.doFilter(req, res);
	}
	<commit_msg>added delete to allowed cors headers<commit_after>package org.opentosca.containerapi;

import java.io.IOException;

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.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CorsFilter implements Filter {
	
	
	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		HttpServletRequest req = (HttpServletRequest) request;
		HttpServletResponse res = (HttpServletResponse) response;
		
		if (req.getHeader("Origin") != null) {
			res.addHeader("Access-Control-Allow-Origin", "*");
			res.addHeader("Access-Control-Expose-Headers", "Origin, Content-Type, X-Cache-Date, Location");
		}
		
		if ("OPTIONS".equals(req.getMethod())) {
			res.addHeader("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PUT, DELETE");
			res.addHeader("Access-Control-Allow-Headers", "Origin, Content-Type, X-Cache-Date, Location");
			res.addHeader("Access-Control-Max-Age", "-1");
		}
		chain.doFilter(req, res);
	}
	
{'fraction_non_alphanumeric': 0.12805872756933115, 'fraction_numerical': 0.0008156606851549756, 'mean_word_length': 5.702185792349726, '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': '2771484', 'n_tokens_mistral': 751, 'n_tokens_neox': 703, 'n_words': 145}