/** * Decode the path segment and add it to the list of path segments. * * @param segments mutable list of path segments. * @param segment path segment to be decoded. * @param decode {@code true} if the path segment should be in a decoded form. */ public static void decodePathSegment(List<PathSegment> segments, String segment, boolean decode) { int colon = segment.indexOf(';'); if (colon != -1) { segments.add(new PathSegmentImpl( (colon == 0) ? "" : segment.substring(0, colon), decode, decodeMatrix(segment, decode))); } else { segments.add(new PathSegmentImpl( segment, decode)); } }
/** * Decode the path segment and add it to the list of path segments. * * @param segments mutable list of path segments. * @param segment path segment to be decoded. * @param decode {@code true} if the path segment should be in a decoded form. */ public static void decodePathSegment(List<PathSegment> segments, String segment, boolean decode) { int colon = segment.indexOf(';'); if (colon != -1) { segments.add(new PathSegmentImpl( (colon == 0) ? "" : segment.substring(0, colon), decode, decodeMatrix(segment, decode))); } else { segments.add(new PathSegmentImpl( segment, decode)); } }
@Override public UriBuilder replaceMatrixParam(String name, Object... values) { checkSsp(); if (name == null) { throw new IllegalArgumentException("Name parameter is null"); } if (matrixParams == null) { int i = path.lastIndexOf("/"); if (i != -1) { i = 0; } matrixParams = UriComponent.decodeMatrix((i != -1) ? path.substring(i) : "", false); i = path.indexOf(";", i); if (i != -1) { path.setLength(i); } } name = encode(name, UriComponent.Type.MATRIX_PARAM); matrixParams.remove(name); if (values != null) { for (Object value : values) { if (value == null) { throw new IllegalArgumentException("One or more of matrix value parameters are null"); } matrixParams.add(name, encode(value.toString(), UriComponent.Type.MATRIX_PARAM)); } } return this; }
@Override public UriBuilder replaceMatrixParam(String name, Object... values) { checkSsp(); if (name == null) { throw new IllegalArgumentException("Name parameter is null"); } if (matrixParams == null) { int i = path.lastIndexOf("/"); if (i != -1) { i = 0; } matrixParams = UriComponent.decodeMatrix((i != -1) ? path.substring(i) : "", false); i = path.indexOf(";", i); if (i != -1) { path.setLength(i); } } name = encode(name, UriComponent.Type.MATRIX_PARAM); matrixParams.remove(name); if (values != null) { for (Object value : values) { if (value == null) { throw new IllegalArgumentException("One or more of matrix value parameters are null"); } matrixParams.add(name, encode(value.toString(), UriComponent.Type.MATRIX_PARAM)); } } return this; }