HttpPost只返回响应体的一部分

时间:2011-05-23 05:35:23

标签: android response http-post chunked

我正在使用HttpPost方法在服务器上执行登录。

CommonsConnection.initHttpConnection();
HttpResponse response;
String contentOfMyInputStream;

HttpGet initPostMethod = new HttpGet("https://stat.volia.com:8443/ktvinet/index.jsp");
response = CommonsConnection.hc.execute(initPostMethod);

HttpPost Statistics = new HttpPost("https://stat.volia.com:8443/ktvinet/j_security_check");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);

nameValuePairs.add(new BasicNameValuePair("j_username", "username"));
nameValuePairs.add(new BasicNameValuePair("j_password", "password"));
nameValuePairs.add(new BasicNameValuePair("submit", "%C2%EE%E9%F2%E8"));

Statistics.setEntity(new UrlEncodedFormEntity(nameValuePairs));
response = CommonsConnection.hc.execute(Statistics);

HttpGet mainPage = new HttpGet("https://stat.volia.com:8443/ktvinet/main.do");
response = CommonsConnection.hc.execute(mainPage);

contentOfMyInputStream = EntityUtils.toString(response.getEntity());

我得到的回复 - 网页正文 - 就像网页的1/5部分,以“......”结尾。 我错过了httpclient的一些参数吗?

2 个答案:

答案 0 :(得分:0)

您是如何检查回复的?如果您正在查看调试器或类似的东西,它可能会截断长字符串,尝试将其转储到文件中。

答案 1 :(得分:0)

Logcat仅显示长字符串响应的一部分。