package com.github.sbugat.samplerest.web.filter;

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

@WebFilter(
		urlPatterns = "/*")
public class ApiOriginFilter implements Filter {

	@Override
	public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
		final HttpServletResponse res = (HttpServletResponse) response;
		res.addHeader("Access-Control-Allow-Origin", "*");
		res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
		res.addHeader("Access-Control-Allow-Headers", "Content-Type");
		chain.doFilter(request, response);
	}

	@Override
	public void destroy() {
	}

	@Override
	public void init(final FilterConfig filterConfig) throws ServletException {
	}
}
@@ -646,19 +646,35 @@
 esponse 
-res
+httpServletResponse
  = (Http
@@ -698,27 +698,43 @@
 response;%0A%09%09
-res
+httpServletResponse
 .addHeader(%22
@@ -767,27 +767,43 @@
 n%22, %22*%22);%0A%09%09
-res
+httpServletResponse
 .addHeader(%22
@@ -862,19 +862,35 @@
 UT%22);%0A%09%09
-res
+httpServletResponse
 .addHead
@@ -937,16 +937,40 @@
 ent-Type
+, api_key, Authorization
 %22);%0A%09%09ch

Add api-key and authorisation in http header