@Test public void testParseQuery_simpleQuery() { String input = "scheme: String query = UriUtils.parseQuery(input); String expectedQuery = URI.create(input).getQuery(); assertThat(input, query, equalTo(expectedQuery)); }
public static String parseQuery(String uri) { if (uri == null) { return null; } int indexOfQuestionMark = uri.indexOf("?"); if (indexOfQuestionMark == -1) { return null; } int indexOfHash = uri.indexOf("#"); String query; if (indexOfHash != -1) { query = uri.substring(indexOfQuestionMark + 1, indexOfHash); } else { query = uri.substring(indexOfQuestionMark + 1); } return query.isEmpty() ? null : query; }
UriUtils { public static String parseQuery(String uri) { if (uri == null) { return null; } int indexOfQuestionMark = uri.indexOf("?"); if (indexOfQuestionMark == -1) { return null; } int indexOfHash = uri.indexOf("#"); String query; if (indexOfHash != -1) { query = uri.substring(indexOfQuestionMark + 1, indexOfHash); } else { query = uri.substring(indexOfQuestionMark + 1); } return query.isEmpty() ? null : query; } }
UriUtils { public static String parseQuery(String uri) { if (uri == null) { return null; } int indexOfQuestionMark = uri.indexOf("?"); if (indexOfQuestionMark == -1) { return null; } int indexOfHash = uri.indexOf("#"); String query; if (indexOfHash != -1) { query = uri.substring(indexOfQuestionMark + 1, indexOfHash); } else { query = uri.substring(indexOfQuestionMark + 1); } return query.isEmpty() ? null : query; } private  UriUtils(); }
UriUtils { public static String parseQuery(String uri) { if (uri == null) { return null; } int indexOfQuestionMark = uri.indexOf("?"); if (indexOfQuestionMark == -1) { return null; } int indexOfHash = uri.indexOf("#"); String query; if (indexOfHash != -1) { query = uri.substring(indexOfQuestionMark + 1, indexOfHash); } else { query = uri.substring(indexOfQuestionMark + 1); } return query.isEmpty() ? null : query; } private  UriUtils(); static List<String> parseSegments(String uri); static List<InetSocketAddress> parseInetSocketAddresses(String uri); static List<InetSocketAddress> parseInetSocketAddresses(String uri, int defaultPort); static String parseScheme(String uri); static String parseAuthority(String uri); static String parseUserInfo(String uri); static String parsePath(String uri); static String parseQuery(String uri); static String appendSegmentToPath(String path, String segment); }
UriUtils { public static String parseQuery(String uri) { if (uri == null) { return null; } int indexOfQuestionMark = uri.indexOf("?"); if (indexOfQuestionMark == -1) { return null; } int indexOfHash = uri.indexOf("#"); String query; if (indexOfHash != -1) { query = uri.substring(indexOfQuestionMark + 1, indexOfHash); } else { query = uri.substring(indexOfQuestionMark + 1); } return query.isEmpty() ? null : query; } private  UriUtils(); static List<String> parseSegments(String uri); static List<InetSocketAddress> parseInetSocketAddresses(String uri); static List<InetSocketAddress> parseInetSocketAddresses(String uri, int defaultPort); static String parseScheme(String uri); static String parseAuthority(String uri); static String parseUserInfo(String uri); static String parsePath(String uri); static String parseQuery(String uri); static String appendSegmentToPath(String path, String segment);  }