Lines Matching refs:uri

214         StringBuilder uri = new StringBuilder();
216 uri.append(scheme);
217 uri.append(':');
220 ALL_LEGAL_ENCODER.appendEncoded(uri, schemeSpecificPart);
223 uri.append('#');
224 ALL_LEGAL_ENCODER.appendEncoded(uri, fragment);
227 parseURI(uri.toString(), false);
247 StringBuilder uri = new StringBuilder();
249 uri.append(scheme);
250 uri.append(':');
254 uri.append("//");
258 USER_INFO_ENCODER.appendEncoded(uri, userInfo);
259 uri.append('@');
267 uri.append(host);
271 uri.append(':');
272 uri.append(port);
276 PATH_ENCODER.appendEncoded(uri, path);
280 uri.append('?');
281 ALL_LEGAL_ENCODER.appendEncoded(uri, query);
285 uri.append('#');
286 ALL_LEGAL_ENCODER.appendEncoded(uri, fragment);
289 parseURI(uri.toString(), true);
312 StringBuilder uri = new StringBuilder();
314 uri.append(scheme);
315 uri.append(':');
318 uri.append("//");
319 AUTHORITY_ENCODER.appendEncoded(uri, authority);
323 PATH_ENCODER.appendEncoded(uri, path);
326 uri.append('?');
327 ALL_LEGAL_ENCODER.appendEncoded(uri, query);
330 uri.append('#');
331 ALL_LEGAL_ENCODER.appendEncoded(uri, fragment);
334 parseURI(uri.toString(), false);
338 * Breaks uri into its component parts. This first splits URI into scheme,
349 private void parseURI(String uri, boolean forceServer) throws URISyntaxException {
350 string = uri;
353 int fragmentStart = UrlUtils.findFirstOf(uri, "#", 0, uri.length());
354 if (fragmentStart < uri.length()) {
355 fragment = ALL_LEGAL_ENCODER.validate(uri, fragmentStart + 1, uri.length(), "fragment");
360 int colon = UrlUtils.findFirstOf(uri, ":", 0, fragmentStart);
361 if (colon < UrlUtils.findFirstOf(uri, "/?#", 0, fragmentStart)) {
363 scheme = validateScheme(uri, colon);
367 throw new URISyntaxException(uri, "Scheme-specific part expected", start);
371 if (!uri.regionMatches(start, "/", 0, 1)) {
374 uri, start, fragmentStart, "scheme specific part");
383 schemeSpecificPart = uri.substring(start, fragmentStart);
387 if (uri.regionMatches(start, "//", 0, 2)) {
389 fileStart = UrlUtils.findFirstOf(uri, "/?", authorityStart, fragmentStart);
390 if (authorityStart == uri.length()) {
391 throw new URISyntaxException(uri, "Authority expected", uri.length());
394 authority = AUTHORITY_ENCODER.validate(uri, authorityStart, fileStart, "authority");
401 int queryStart = UrlUtils.findFirstOf(uri, "?", fileStart, fragmentStart);
402 path = PATH_ENCODER.validate(uri, fileStart, queryStart, "path");
406 query = ALL_LEGAL_ENCODER.validate(uri, queryStart + 1, fragmentStart, "query");
412 private String validateScheme(String uri, int end) throws URISyntaxException {
414 throw new URISyntaxException(uri, "Scheme expected", 0);
418 if (!UrlUtils.isValidSchemeChar(i, uri.charAt(i))) {
419 throw new URISyntaxException(uri, "Illegal character in scheme", 0);
423 return uri.substring(0, end);
495 // this is a server based uri,
503 private void validateUserInfo(String uri, String userInfo, int index)
508 throw new URISyntaxException(uri, "Illegal character in userInfo", index + i);
598 * Compares this URI with the given argument {@code uri}. This method will
608 * @param uri
612 public int compareTo(URI uri) {
616 if (scheme == null && uri.scheme != null) {
618 } else if (scheme != null && uri.scheme == null) {
620 } else if (scheme != null && uri.scheme != null) {
621 ret = scheme.compareToIgnoreCase(uri.scheme);
628 if (!opaque && uri.opaque) {
630 } else if (opaque && !uri.opaque) {
632 } else if (opaque && uri.opaque) {
633 ret = schemeSpecificPart.compareTo(uri.schemeSpecificPart);
642 if (authority != null && uri.authority == null) {
644 } else if (authority == null && uri.authority != null) {
646 } else if (authority != null && uri.authority != null) {
647 if (host != null && uri.host != null) {
649 if (userInfo != null && uri.userInfo == null) {
651 } else if (userInfo == null && uri.userInfo != null) {
653 } else if (userInfo != null && uri.userInfo != null) {
654 ret = userInfo.compareTo(uri.userInfo);
661 ret = host.compareToIgnoreCase(uri.host);
667 if (port != uri.port) {
668 return port - uri.port;
672 ret = authority.compareTo(uri.authority);
681 ret = path.compareTo(uri.path);
688 if (query != null && uri.query == null) {
690 } else if (query == null && uri.query != null) {
692 } else if (query != null && uri.query != null) {
693 ret = query.compareTo(uri.query);
701 if (fragment != null && uri.fragment == null) {
703 } else if (fragment == null && uri.fragment != null) {
705 } else if (fragment != null && uri.fragment != null) {
706 ret = fragment.compareTo(uri.fragment);
717 * Returns the URI formed by parsing {@code uri}. This method behaves
723 public static URI create(String uri) {
725 return new URI(uri);
802 URI uri = (URI) o;
804 if (uri.fragment == null && fragment != null || uri.fragment != null
807 } else if (uri.fragment != null && fragment != null) {
808 if (!escapedEquals(uri.fragment, fragment)) {
813 if (uri.scheme == null && scheme != null || uri.scheme != null
816 } else if (uri.scheme != null && scheme != null) {
817 if (!uri.scheme.equalsIgnoreCase(scheme)) {
822 if (uri.opaque && opaque) {
823 return escapedEquals(uri.schemeSpecificPart,
825 } else if (!uri.opaque && !opaque) {
826 if (!escapedEquals(path, uri.path)) {
830 if (uri.query != null && query == null || uri.query == null
833 } else if (uri.query != null && query != null) {
834 if (!escapedEquals(uri.query, query)) {
839 if (uri.authority != null && authority == null
840 || uri.authority == null && authority != null) {
842 } else if (uri.authority != null && authority != null) {
843 if (uri.host != null && host == null || uri.host == null
846 } else if (uri.host == null && host == null) {
848 return escapedEquals(uri.authority, authority);
849 } else { // uri.host != null && host != null, so server-based
850 if (!host.equalsIgnoreCase(uri.host)) {
854 if (port != uri.port) {
858 if (uri.userInfo != null && userInfo == null
859 || uri.userInfo == null && userInfo != null) {
861 } else if (uri.userInfo != null && userInfo != null) {
862 return escapedEquals(userInfo, uri.userInfo);