use of cz.msebera.android.httpclient.impl.client.AbstractHttpClient in project AndroidStudy by tinggengyan.
the class HttpCookie method run.
@Override
public void run() {
list.add(new BasicNameValuePair("name", "steve"));
list.add(new BasicNameValuePair("age", "12"));
try {
post.setEntity(new UrlEncodedFormEntity(list));
HttpResponse response = client.execute(post);
if (response.getStatusLine().getStatusCode() == 200) {
AbstractHttpClient absclient = (AbstractHttpClient) client;
List<Cookie> cookies = absclient.getCookieStore().getCookies();
for (Cookie cookie : cookies) {
System.out.println("name==" + cookie.getName());
System.out.println("value==" + cookie.getValue());
Message message = new Message();
message.obj = cookie;
mHandler.sendMessage(message);
return;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations