public static String replaceTokens ( final String value , final Map < String , String > contextInfo , final boolean withEncoding ) { String result = value ; String tokenValue = encodeQueryParam ( contextInfo . get ( CONTEXT_SERVER_TOKEN ) , withEncoding ) ; result = result . replaceFirst ( Pattern . quote ( CONTEXT_SERVER_TOKEN ) , tokenValue ) ; tokenValue = encodeQueryParam ( contextInfo . get ( CONTEXT_PROJECT_TOKEN ) , withEncoding ) ; result = result . replaceFirst ( Pattern . quote ( CONTEXT_PROJECT_TOKEN ) , tokenValue ) ; tokenValue = encodeQueryParam ( contextInfo . get ( CONTEXT_FLOW_TOKEN ) , withEncoding ) ; result = result . replaceFirst ( Pattern . quote ( CONTEXT_FLOW_TOKEN ) , tokenValue ) ; tokenValue = encodeQueryParam ( contextInfo . get ( CONTEXT_JOB_TOKEN ) , withEncoding ) ; result = result . replaceFirst ( Pattern . quote ( CONTEXT_JOB_TOKEN ) , tokenValue ) ; tokenValue = encodeQueryParam ( contextInfo . get ( CONTEXT_EXECUTION_ID_TOKEN ) , withEncoding ) ; result = result . replaceFirst ( Pattern . quote ( CONTEXT_EXECUTION_ID_TOKEN ) , tokenValue ) ; tokenValue = encodeQueryParam ( contextInfo . get ( CONTEXT_JOB_STATUS_TOKEN ) , withEncoding ) ; result = result . replaceFirst ( Pattern . quote ( CONTEXT_JOB_STATUS_TOKEN ) , tokenValue ) ; return result ; }
Replace the supported tokens in the URL with values in the contextInfo . This will also make sure the values are HTTP encoded .