0

在下面的示例代码中,什么时候 uri 不等于 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
}
4

1 回答 1

0

URL 是 URI 的子集。所以 URL 可以转换为 URI,但 URI 不能转换为 URL。

于 2013-07-12T00:38:38.670 回答