This repository has been archived by the owner on Feb 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change placeholder processing & better logging
- Loading branch information
Showing
2 changed files
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* @author [email protected] | ||
|
@@ -49,11 +50,20 @@ public void addPlaceholder(String placeholder, String value) { | |
} | ||
|
||
|
||
public String processPlaceholders(String processedURL, FoxHttpClient foxHttpClient) { | ||
public String processPlaceholders(final String processedURL, FoxHttpClient foxHttpClient) { | ||
String parsedString = processedURL; | ||
Pattern p = Pattern.compile(placeholderEscapeCharEnd); | ||
for (Map.Entry<String, String> entry : this.getPlaceholderMap().entrySet()) { | ||
foxHttpClient.getFoxHttpLogger().log("-> " + this.getPlaceholderEscapeCharStart() + entry.getKey() + this.getPlaceholderEscapeCharEnd() + " -> " + entry.getValue()); | ||
processedURL = processedURL.replace(this.getPlaceholderEscapeCharStart() + entry.getKey() + this.getPlaceholderEscapeCharEnd(), entry.getValue()); | ||
if (p.matcher(parsedString).find()) { | ||
parsedString = parsedString.replace(this.getPlaceholderEscapeCharStart() + entry.getKey() + this.getPlaceholderEscapeCharEnd(), entry.getValue()); | ||
foxHttpClient.getFoxHttpLogger().log( | ||
processedURL + | ||
" -> (" + this.getPlaceholderEscapeCharStart() + entry.getKey() + this.getPlaceholderEscapeCharEnd() + " -> " + entry.getValue() + | ||
") -> " + parsedString); | ||
} else { | ||
break; | ||
} | ||
} | ||
return processedURL; | ||
return parsedString; | ||
} | ||
} |