@Test public void testDecodeMatrix() { _testDecodeMatrix("path", "path"); _testDecodeMatrix("path;", "path"); _testDecodeMatrix("path;=", "path"); _testDecodeMatrix("path;=junk", "path"); _testDecodeMatrix("path;;", "path"); _testDecodeMatrix("path;a", "path", "a", ""); _testDecodeMatrix("path;;a", "path", "a", ""); _testDecodeMatrix("path;a;", "path", "a", ""); _testDecodeMatrix("path;a;;", "path", "a", ""); _testDecodeMatrix("path;a=", "path", "a", ""); _testDecodeMatrix("path;a=;", "path", "a", ""); _testDecodeMatrix("path;a=;;", "path", "a", ""); _testDecodeMatrix("path;a=x", "path", "a", "x"); _testDecodeMatrix("path;a=x;", "path", "a", "x"); _testDecodeMatrix("path;a=x;;", "path", "a", "x"); _testDecodeMatrix("path;a=x;b=y", "path", "a", "x", "b", "y"); _testDecodeMatrix("path;a=x;;b=y", "path", "a", "x", "b", "y"); _testDecodeMatrix("path;a==x;", "path", "a", "=x"); _testDecodeMatrix("", ""); _testDecodeMatrix(";", ""); _testDecodeMatrix(";=", ""); _testDecodeMatrix(";=junk", ""); _testDecodeMatrix(";;", ""); _testDecodeMatrix(";a", "", "a", ""); _testDecodeMatrix(";;a", "", "a", ""); _testDecodeMatrix(";a;", "", "a", ""); _testDecodeMatrix(";a;;", "", "a", ""); _testDecodeMatrix(";a=", "", "a", ""); _testDecodeMatrix(";a=;", "", "a", ""); _testDecodeMatrix(";a=;;", "", "a", ""); _testDecodeMatrix(";a=x", "", "a", "x"); _testDecodeMatrix(";a==x", "", "a", "=x"); _testDecodeMatrix(";a=x;", "", "a", "x"); _testDecodeMatrix(";a=x;;", "", "a", "x"); _testDecodeMatrix(";a=x;b=y", "", "a", "x", "b", "y"); _testDecodeMatrix(";a=x;;b=y", "", "a", "x", "b", "y"); _testDecodeMatrix(";%20a%20=%20x%20", "", true, " a ", " x "); _testDecodeMatrix(";%20a%20=%20x%20", "", false, " a ", "%20x%20"); }
public static MultivaluedMap<String, String> decodeMatrix(final String pathSegment, final boolean decode) { final MultivaluedMap<String, String> matrixMap = new MultivaluedStringMap(); int s = pathSegment.indexOf(';') + 1; if (s == 0 || s == pathSegment.length()) { return matrixMap; } do { final int e = pathSegment.indexOf(';', s); if (e == -1) { decodeMatrixParam(matrixMap, pathSegment.substring(s), decode); } else if (e > s) { decodeMatrixParam(matrixMap, pathSegment.substring(s, e), decode); } s = e + 1; } while (s > 0 && s < pathSegment.length()); return matrixMap; }
UriComponent { public static MultivaluedMap<String, String> decodeMatrix(final String pathSegment, final boolean decode) { final MultivaluedMap<String, String> matrixMap = new MultivaluedStringMap(); int s = pathSegment.indexOf(';') + 1; if (s == 0 || s == pathSegment.length()) { return matrixMap; } do { final int e = pathSegment.indexOf(';', s); if (e == -1) { decodeMatrixParam(matrixMap, pathSegment.substring(s), decode); } else if (e > s) { decodeMatrixParam(matrixMap, pathSegment.substring(s, e), decode); } s = e + 1; } while (s > 0 && s < pathSegment.length()); return matrixMap; } }
UriComponent { public static MultivaluedMap<String, String> decodeMatrix(final String pathSegment, final boolean decode) { final MultivaluedMap<String, String> matrixMap = new MultivaluedStringMap(); int s = pathSegment.indexOf(';') + 1; if (s == 0 || s == pathSegment.length()) { return matrixMap; } do { final int e = pathSegment.indexOf(';', s); if (e == -1) { decodeMatrixParam(matrixMap, pathSegment.substring(s), decode); } else if (e > s) { decodeMatrixParam(matrixMap, pathSegment.substring(s, e), decode); } s = e + 1; } while (s > 0 && s < pathSegment.length()); return matrixMap; } private  UriComponent(); }
UriComponent { public static MultivaluedMap<String, String> decodeMatrix(final String pathSegment, final boolean decode) { final MultivaluedMap<String, String> matrixMap = new MultivaluedStringMap(); int s = pathSegment.indexOf(';') + 1; if (s == 0 || s == pathSegment.length()) { return matrixMap; } do { final int e = pathSegment.indexOf(';', s); if (e == -1) { decodeMatrixParam(matrixMap, pathSegment.substring(s), decode); } else if (e > s) { decodeMatrixParam(matrixMap, pathSegment.substring(s, e), decode); } s = e + 1; } while (s > 0 && s < pathSegment.length()); return matrixMap; } private  UriComponent(); static void validate(final String s, final Type t); static void validate(final String s, final Type t, final boolean template); static boolean valid(final String s, final Type t); static boolean valid(final String s, final Type t, final boolean template); static String contextualEncode(final String s, final Type t); static String contextualEncode(final String s, final Type t, final boolean template); static String encode(final String s, final Type t); static String encode(final String s, final Type t, final boolean template); static String encodeTemplateNames(String s); static String decode(final String s, final Type t); static MultivaluedMap<String, String> decodeQuery(final URI u, final boolean decode); static MultivaluedMap<String, String> decodeQuery(final String q, final boolean decode); static MultivaluedMap<String, String> decodeQuery(final String q, final boolean decodeNames,
                                                             final boolean decodeValues); static List<PathSegment> decodePath(final URI u, final boolean decode); static List<PathSegment> decodePath(final String path, final boolean decode); static void decodePathSegment(final List<PathSegment> segments, final String segment, final boolean decode); static MultivaluedMap<String, String> decodeMatrix(final String pathSegment, final boolean decode); static boolean isHexCharacter(final char c); static String fullRelativeUri(final URI uri); }
UriComponent { public static MultivaluedMap<String, String> decodeMatrix(final String pathSegment, final boolean decode) { final MultivaluedMap<String, String> matrixMap = new MultivaluedStringMap(); int s = pathSegment.indexOf(';') + 1; if (s == 0 || s == pathSegment.length()) { return matrixMap; } do { final int e = pathSegment.indexOf(';', s); if (e == -1) { decodeMatrixParam(matrixMap, pathSegment.substring(s), decode); } else if (e > s) { decodeMatrixParam(matrixMap, pathSegment.substring(s, e), decode); } s = e + 1; } while (s > 0 && s < pathSegment.length()); return matrixMap; } private  UriComponent(); static void validate(final String s, final Type t); static void validate(final String s, final Type t, final boolean template); static boolean valid(final String s, final Type t); static boolean valid(final String s, final Type t, final boolean template); static String contextualEncode(final String s, final Type t); static String contextualEncode(final String s, final Type t, final boolean template); static String encode(final String s, final Type t); static String encode(final String s, final Type t, final boolean template); static String encodeTemplateNames(String s); static String decode(final String s, final Type t); static MultivaluedMap<String, String> decodeQuery(final URI u, final boolean decode); static MultivaluedMap<String, String> decodeQuery(final String q, final boolean decode); static MultivaluedMap<String, String> decodeQuery(final String q, final boolean decodeNames,
                                                             final boolean decodeValues); static List<PathSegment> decodePath(final URI u, final boolean decode); static List<PathSegment> decodePath(final String path, final boolean decode); static void decodePathSegment(final List<PathSegment> segments, final String segment, final boolean decode); static MultivaluedMap<String, String> decodeMatrix(final String pathSegment, final boolean decode); static boolean isHexCharacter(final char c); static String fullRelativeUri(final URI uri);  }