public static Map < String , String > buildHeaders ( String reqCorsHeader , String requestUri ) { Map < String , String > result = new LinkedHashMap <> ( ) ; result . put ( CORS_ALLOW_ORIGIN , requestUri ) ; result . put ( CORS_ALLOW_METHODS , VALUE_ALLOWED_METHODS ) ; result . put ( CORS_ALLOW_CREDENTIALS , VALUE_ALLOW_CREDENTIALS ) ; if ( ! Utils . isEmptyOrWhitespaces ( reqCorsHeader ) ) result . put ( CORS_ALLOW_HEADERS , reqCorsHeader ) ; return result ; }
Finds the right headers to set on the response to prevent CORS issues .