@@ -0,0 +1,1994 @@
+package dbathon.web.gvds.rest;%0A%0Aimport java.io.IOException;%0Aimport javax.servlet.Filter;%0Aimport javax.servlet.FilterChain;%0Aimport javax.servlet.FilterConfig;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.ServletRequest;%0Aimport javax.servlet.ServletResponse;%0Aimport javax.servlet.annotation.WebFilter;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport com.google.common.base.Strings;%0A%0A/**%0A * Simple CORS filter that basically allows everything from any origin. It also directly handles%0A * OPTIONS requests.%0A */%0A@WebFilter(urlPatterns = %22/*%22)%0Apublic class CorsFilter implements Filter %7B%0A%0A  private static final String ALLOWED_METHODS = %22GET,POST,PUT,DELETE,HEAD,OPTIONS%22;%0A  private static final String ALLOWED_HEADERS = %22origin,accept,content-type,authorization%22;%0A%0A  @Override%0A  public void init(FilterConfig filterConfig) throws ServletException %7B%7D%0A%0A  @Override%0A  public void destroy() %7B%7D%0A%0A  @Override%0A  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)%0A      throws IOException, ServletException %7B%0A%0A    final HttpServletRequest httpRequest = (HttpServletRequest) request;%0A    final HttpServletResponse httpResponse = (HttpServletResponse) response;%0A%0A    final String origin = httpRequest.getHeader(%22Origin%22);%0A%0A    if (!Strings.isNullOrEmpty(origin)) %7B%0A      httpResponse.addHeader(%22Access-Control-Allow-Origin%22, origin);%0A      httpResponse.addHeader(%22Access-Control-Allow-Credentials%22, %22true%22);%0A      httpResponse.addHeader(%22Access-Control-Allow-Methods%22, ALLOWED_METHODS);%0A      httpResponse.addHeader(%22Access-Control-Allow-Headers%22, ALLOWED_HEADERS);%0A      httpResponse.addHeader(%22Access-Control-Max-Age%22, %2286400%22);%0A    %7D%0A%0A    if (%22OPTIONS%22.equals(httpRequest.getMethod())) %7B%0A      // just return 200 OK%0A      httpResponse.addHeader(%22Allow%22, ALLOWED_METHODS);%0A      httpResponse.setStatus(HttpServletResponse.SC_OK);%0A    %7D%0A    else %7B%0A      chain.doFilter(request, response);%0A    %7D%0A  %7D%0A%0A%7D%0A

add a simple CORS filter to allow cross-origin requests