public KeycloakUriBuilder segment(String... segments) throws IllegalArgumentException { if (segments == null) throw new IllegalArgumentException("segments parameter was null"); for (String segment : segments) { if (segment == null) throw new IllegalArgumentException("A segment is null"); path(Encode.encodePathSegment(segment)); } return this; }
protected StringBuffer replacePathParameter(String name, String value, boolean isEncoded, String string, StringBuffer buffer, boolean encodeSlash) { Matcher matcher = createUriParamMatcher(string); while (matcher.find()) { String param = matcher.group(1); if (!param.equals(name)) continue; if (!isEncoded) { if (encodeSlash) value = Encode.encodePath(value); else value = Encode.encodePathSegment(value); } else { value = Encode.encodeNonCodes(value); } // if there is a $ then we must backslash it or it will screw up regex group substitution value = value.replace("$", "\\$"); matcher.appendReplacement(buffer, value); } matcher.appendTail(buffer); return buffer; }