code: public void handleInvalidCORS(final HttpServletRequest request,
              final HttpServletResponse response, final FilterChain filterChain) {
          String origin = request.getHeader(CORSFilter.REQUEST_HEADER_ORIGIN);
          String method = request.getMethod();
          String accessControlRequestHeaders =
                  request.getHeader(REQUEST_HEADER_ACCESS_CONTROL_REQUEST_HEADERS);
  
          String message =
                  "Invalid CORS request; Origin=" + origin + ";Method=" + method;
          if (accessControlRequestHeaders != null) {
              message =
                      message + ";Access-Control-Request-Headers="
                              + accessControlRequestHeaders;
          }
          response.setContentType("text/plain");
          response.setStatus(HttpServletResponse.SC_FORBIDDEN);
          response.resetBuffer();
  
          log(message);
      }
docs: Handles a CORS request that violates specification.
  
  @param request
  The {@link HttpServletRequest} object.
  @param response
  The {@link HttpServletResponse} object.
  @param filterChain
  The {@link FilterChain} object.
  @throws IOException
  @throws ServletException