我正在使用以下代码在Android中执行HTTP请求。一切似乎都很好,但似乎响应在某些时候被修剪,我无法读取所请求网址的全部内容。
响应是否有任何大小限制?
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet(someUrl);
HttpResponse response = httpclient.execute(request);
StatusLine statusLine = response.getStatusLine();
if(statusLine.getStatusCode() == HttpStatus.SC_OK){
ByteArrayOutputStream out = new ByteArrayOutputStream();
response.getEntity().writeTo(out);
out.close();
String responseString = out.toString();
Log.w("Response", responseString); // The response is clipped at some point
}
谢谢。
答案 0 :(得分:0)
好的,傻我。原来这是一个日志问题。我检查了尺寸,完整的内容就在那里。问题在于LogCat的大小限制,如以下答案中所述。
What is the size limit for Logcat and how to change its capacity?
干杯