【发布时间】:2015-10-13 03:24:29
【问题描述】:
HttpURLConnection connection =(HttpURLConnection)blogFeedUrl.openConnection();
connection.connect();
int contentLength = connection.getContentLength();
所以我有这两行代码,当:
URL blogFeedUrl = new URL("http://blog.teamtreehouse.com/api/get_recent_summary/?count=2");
一切正常,contentLength 得到一个可接受的值。 但是当:
URL blogFeedUrl = new URL("http://raja12.esy.es/api/get_recent_summary/?count=2");
getContentLength 返回 -1 并且它不起作用。 问题是这两个 url 是相似的(你可以检查)。这太令人困惑了! 谢谢!
【问题讨论】:
标签: java android json url httpurlconnection