Android Cookie(HTTP使用)

HttpGet request = new HttpGet(
"http://xxxx.xxx/xxxxx");
request.setHeader("Cookie", "key=" + “xxxxxxxxxxx”);//服务器自定义Cookie
HttpResponse response = httpclient.execute(request); // 模拟请求
int code = response.getStatusLine().getStatusCode();// 返回响应码
InputStream in = response.getEntity().getContent();// 服务器返回的数据
System.out.println(inputStreamToString(in));

posted @ 2014-12-04 20:38  绚丽星空  阅读(635)  评论(0编辑  收藏  举报