我使用HttpClient最新版本(4.x)。现在我试图做一个GET请求。
我刚刚发布Get请求。
这是我的代码
public class Poster {
static boolean routing1 = true, routing2 = true;
static int counter1 = 0, counter2 = 0;
DefaultHttpClient oHtp = null;
HttpGet oHGet = null;
HttpResponse oHRes = null;
private void test(String fullAddress) throws Exception {
oHtp = new DefaultHttpClient();
oHGet = new HttpGet(fullAddress);
HttpResponse response = oHtp.execute(oHGet);
System.out.print(response.getStatusLine());
HttpEntity entity = response.getEntity();
if (entity != null) {
entity = new BufferedHttpEntity(entity);
// System.out.println(EntityUtils.toString(entity));
System.out.print("\t entity is retrieved... ");
}
oHtp.getConnectionManager().shutdown();
}
}
我只是很好地执行它。
首先是
new Poster().test("http://123.xl.co.id/profile.php");
第二是
new Poster().test("http://goklik.co.id/");
ya,只有第二个….我得到这个错误信息;
Sep 18, 2011 10:11:30 AM
org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: “[version: 0][name: CookiePst][value:
0149=xwGHF7HYDHLHQ84Isp/eSy9vu+Xq6cT12wxg1A==][domain:
.mcore.com][path: /][expiry: Sun Sep 18 10:38:59 ICT 2011]”. Illegal
domain attribute “mcore.com”. Domain of origin: “goklik.co.id”
我意识到Cookie在这里涉及。但我不明白警告是什么意思。而且我也不知道如何解决它(Cookie不被拒绝)。 HOpe有一点点清楚我的想法从你们….:D