|
|
|
@ -716,18 +716,35 @@ public class UriComponentsBuilder implements Cloneable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void addPath(String path) { |
|
|
|
public void addPath(String path) { |
|
|
|
if (StringUtils.hasText(path)) { |
|
|
|
if (!StringUtils.hasText(path)) { |
|
|
|
PathSegmentComponentBuilder psBuilder = getLastBuilder(PathSegmentComponentBuilder.class); |
|
|
|
return; |
|
|
|
FullPathComponentBuilder fpBuilder = getLastBuilder(FullPathComponentBuilder.class); |
|
|
|
} |
|
|
|
if (psBuilder != null) { |
|
|
|
int startIndex = path.indexOf("{/"); |
|
|
|
path = path.startsWith("/") ? path : "/" + path; |
|
|
|
while (startIndex != -1) { |
|
|
|
} |
|
|
|
String pathToAdd = path.substring(0, startIndex); |
|
|
|
if (fpBuilder == null) { |
|
|
|
addPathInternal(pathToAdd); |
|
|
|
fpBuilder = new FullPathComponentBuilder(); |
|
|
|
|
|
|
|
this.builders.add(fpBuilder); |
|
|
|
int endIndex = path.indexOf("}", startIndex); |
|
|
|
} |
|
|
|
String pathSegmentToAdd = "{" + path.substring(startIndex + 2, endIndex) + "}"; |
|
|
|
fpBuilder.append(path); |
|
|
|
addPathSegments(pathSegmentToAdd); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
path = (endIndex >= path.length()) ? "" : path.substring(endIndex + 1); |
|
|
|
|
|
|
|
startIndex = path.indexOf("{/"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
addPathInternal(path); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void addPathInternal(String path) { |
|
|
|
|
|
|
|
PathSegmentComponentBuilder psBuilder = getLastBuilder(PathSegmentComponentBuilder.class); |
|
|
|
|
|
|
|
FullPathComponentBuilder fpBuilder = getLastBuilder(FullPathComponentBuilder.class); |
|
|
|
|
|
|
|
if (psBuilder != null) { |
|
|
|
|
|
|
|
path = path.startsWith("/") ? path : "/" + path; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fpBuilder == null) { |
|
|
|
|
|
|
|
fpBuilder = new FullPathComponentBuilder(); |
|
|
|
|
|
|
|
this.builders.add(fpBuilder); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fpBuilder.append(path); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|