@Override public UriBuilder replaceMatrix(String matrixValues) throws IllegalArgumentException { String encodedMatrixValues = matrixValues != null ? HttpUtils.pathEncode(matrixValues) : null; this.matrix = JAXRSUtils.getStructuredParams(encodedMatrixValues, ";", true, false); return this; }
/** * Encodes partially encoded string. Encode all values but those matching pattern * "percent char followed by two hexadecimal digits". * * @param encoded fully or partially encoded string. * @return fully encoded string */ public static String encodePartiallyEncoded(String encoded, boolean query) { if (encoded.length() == 0) { return encoded; } Matcher m = ENCODE_PATTERN.matcher(encoded); StringBuilder sb = new StringBuilder(); int i = 0; while (m.find()) { String before = encoded.substring(i, m.start()); sb.append(query ? HttpUtils.queryEncode(before) : HttpUtils.pathEncode(before)); sb.append(m.group()); i = m.end(); } String tail = encoded.substring(i, encoded.length()); sb.append(query ? HttpUtils.queryEncode(tail) : HttpUtils.pathEncode(tail)); return sb.toString(); }
/** * Encodes partially encoded string. Encode all values but those matching pattern * "percent char followed by two hexadecimal digits". * * @param encoded fully or partially encoded string. * @return fully encoded string */ public static String encodePartiallyEncoded(String encoded, boolean query) { if (encoded.length() == 0) { return encoded; } Matcher m = ENCODE_PATTERN.matcher(encoded); if (!m.find()) { return query ? HttpUtils.queryEncode(encoded) : HttpUtils.pathEncode(encoded); } int length = encoded.length(); StringBuilder sb = new StringBuilder(length + 8); int i = 0; do { String before = encoded.substring(i, m.start()); sb.append(query ? HttpUtils.queryEncode(before) : HttpUtils.pathEncode(before)); sb.append(m.group()); i = m.end(); } while (m.find()); String tail = encoded.substring(i, length); sb.append(query ? HttpUtils.queryEncode(tail) : HttpUtils.pathEncode(tail)); return sb.toString(); }
oval = HttpUtils.encodePartiallyEncoded(oval.toString(), isQuery); } else { oval = isQuery ? HttpUtils.queryEncode(oval.toString()) : HttpUtils.pathEncode(oval.toString());
oval = HttpUtils.encodePartiallyEncoded(oval.toString(), isQuery); } else { oval = isQuery ? HttpUtils.queryEncode(oval.toString()) : HttpUtils.pathEncode(oval.toString());
value = HttpUtils.encodePartiallyEncoded(value, isQuery); } else { value = isQuery ? HttpUtils.queryEncode(value) : HttpUtils.pathEncode(value);
value = HttpUtils.encodePartiallyEncoded(value, isQuery); } else { value = isQuery ? HttpUtils.queryEncode(value) : HttpUtils.pathEncode(value);
return uriAsTemplate(path); String pathEncoded = HttpUtils.pathEncode(path);