简体   繁体   中英

What is the difference between URI and URL in HttpClient

In the sample code below, when would the uri not equals with url?

HttpClient client = new DefaultHttpClient();
String url = "http://domain/path1/path2"
HttpGet get = new HttpGet(toFetchURL);
HttpResponse response = client.execute(get);

String uri = get.getURI.toString();
if (!uri.equals(url)) {
    // when would this happen?
    // some logic
}

URL is a subset of URI. so a URL can be converted to URI, but URI can't convert to URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM