|
|
|
@ -243,7 +243,7 @@ public abstract class UriComponents implements Serializable {
@@ -243,7 +243,7 @@ public abstract class UriComponents implements Serializable {
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
static String expandUriComponent(@Nullable String source, UriTemplateVariables uriVariables, |
|
|
|
|
@Nullable UnaryOperator<String> variableEncoder) { |
|
|
|
|
@Nullable UnaryOperator<String> encoder) { |
|
|
|
|
|
|
|
|
|
if (source == null) { |
|
|
|
|
return null; |
|
|
|
@ -258,15 +258,14 @@ public abstract class UriComponents implements Serializable {
@@ -258,15 +258,14 @@ public abstract class UriComponents implements Serializable {
|
|
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
|
while (matcher.find()) { |
|
|
|
|
String match = matcher.group(1); |
|
|
|
|
String variableName = getVariableName(match); |
|
|
|
|
Object variablesValue = uriVariables.getValue(variableName); |
|
|
|
|
if (UriTemplateVariables.SKIP_VALUE.equals(variablesValue)) { |
|
|
|
|
String varName = getVariableName(match); |
|
|
|
|
Object varValue = uriVariables.getValue(varName); |
|
|
|
|
if (UriTemplateVariables.SKIP_VALUE.equals(varValue)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
String formattedValue = getVariableValueAsString(variablesValue); |
|
|
|
|
formattedValue = Matcher.quoteReplacement(formattedValue); |
|
|
|
|
formattedValue = variableEncoder != null ? variableEncoder.apply(formattedValue) : formattedValue; |
|
|
|
|
matcher.appendReplacement(sb, formattedValue); |
|
|
|
|
String formatted = getVariableValueAsString(varValue); |
|
|
|
|
formatted = encoder != null ? encoder.apply(formatted) : Matcher.quoteReplacement(formatted); |
|
|
|
|
matcher.appendReplacement(sb, formatted); |
|
|
|
|
} |
|
|
|
|
matcher.appendTail(sb); |
|
|
|
|
return sb.toString(); |
|
|
|
|