ClientProtocolException Android

时间:2013-05-09 16:12:29

标签: android exception http-get

所以我试图用我的android设备浏览到localhost网页。当我在我的Android浏览器中放入以下网址时,它可以工作:

http://192.168.x.x/timecode

但是当我尝试通过httpget访问时,就像这样

HttpClient client = new DefaultHttpClient();
URI website = new URI("http://192.168.x.x:8000/timecode");
HttpGet request = new HttpGet();
request.setURI(website);
HttpResponse response =client.execute(request);

引发例外

org.apache.http.client.ClientProtocolException

当我看到StackTrace时,我看到一些有趣的东西,我认为它可能与异常有关

org.apache.http.ParseException: Unable to parse status code from status line HTTP/1.1

我打算做的是获取我想要访问的页面的内容,并且就像这样简单:

{
"currentTime": "00:00:02"  
"videoId": "video2"
}

我不知道出了什么问题。我知道它不是因为它的url因为它适用于每个浏览器,所以我猜它与HttpClient有关,但我不知道是什么。

有人可以帮我解决这个问题吗?

由于

0 个答案:

没有答案