0

我正在使用 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 的一些参数?

4

2 回答 2

0

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

于 2011-05-23T05:50:51.370 回答
0

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

于 2011-05-23T05:38:06.187 回答