@Override public List<PathSegment> getPathSegments(String name) { return getPathSegments(name, true); }
@Override public List<PathSegment> getPathSegments(String name, boolean decode) { int[] bounds = getPathParameterBounds(name); if (bounds != null) { String path = matchResults.getLast().group(); // Work out how many path segments are up to the start // and end position of the matching path parameter value // This assumes that the path always starts with a '/' int segmentsStart = 0; for (int x = 0; x < bounds[0]; x++) { if (path.charAt(x) == '/') { segmentsStart++; } } int segmentsEnd = segmentsStart; for (int x = bounds[0]; x < bounds[1]; x++) { if (path.charAt(x) == '/') { segmentsEnd++; } } return getPathSegments(decode).subList(segmentsStart - 1, segmentsEnd); } else return Collections.emptyList(); }
@Override public List<PathSegment> getPathSegments(String name) { return getPathSegments(name, true); }
@Override public List<PathSegment> getPathSegments(String name) { return getPathSegments(name, true); }
@Override public List<PathSegment> getPathSegments(String name, boolean decode) { int[] bounds = getPathParameterBounds(name); if (bounds != null) { String path = matchResults.getLast().group(); // Work out how many path segments are up to the start // and end position of the matching path parameter value // This assumes that the path always starts with a '/' int segmentsStart = 0; for (int x = 0; x < bounds[0]; x++) { if (path.charAt(x) == '/') { segmentsStart++; } } int segmentsEnd = segmentsStart; for (int x = bounds[0]; x < bounds[1]; x++) { if (path.charAt(x) == '/') { segmentsEnd++; } } return getPathSegments(decode).subList(segmentsStart - 1, segmentsEnd); } else return Collections.emptyList(); }
@Override public List<PathSegment> getPathSegments(String name, boolean decode) { int[] bounds = getPathParameterBounds(name); if (bounds != null) { String path = matchResults.getLast().group(); // Work out how many path segments are up to the start // and end position of the matching path parameter value // This assumes that the path always starts with a '/' int segmentsStart = 0; for (int x = 0; x < bounds[0]; x++) { if (path.charAt(x) == '/') { segmentsStart++; } } int segmentsEnd = segmentsStart; for (int x = bounds[0]; x < bounds[1]; x++) { if (path.charAt(x) == '/') { segmentsEnd++; } } return getPathSegments(decode).subList(segmentsStart - 1, segmentsEnd); } else return Collections.emptyList(); }