public static Response . ResponseBuilder makeCORS ( Response . ResponseBuilder responseBuilder , String returnMethod ) { // TODO(william): Make origin, methods, and headers configurable. Response . ResponseBuilder rb = responseBuilder . header ( "Access-Control-Allow-Origin" , "*" ) . header ( "Access-Control-Allow-Methods" , "GET, POST, OPTIONS" ) ; if ( ! "" . equals ( returnMethod ) ) { rb . header ( "Access-Control-Allow-Headers" , returnMethod ) ; } return rb ; }
Makes the responseBuilder CORS compatible .