안드로이드 개발 질문/답변
(글 수 45,052)
String postURL = "주소";
Log.d("log", "postURL == " + postURL);
HttpPost post = new HttpPost(postURL);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("usr_id",id));
params.add(new BasicNameValuePair("usr_passwd",password));
params.add(new BasicNameValuePair("device_id",C2DMReceiver.registration_id));
params.add(new BasicNameValuePair("login_from","android"));
UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params, "euc-kr");
post.setEntity(ent);
HttpResponse responsePOST = client.execute(post);
Log.v("log", responsePOST.getHeaders("Set-Cookie").toString());
HttpEntity resEntity = responsePOST.getEntity();
String xml = EntityUtils.toString(resEntity);
if (resEntity != null) {
Log.d("log", xml);
}
List<Cookie> cookies = ((DefaultHttpClient)client).getCookieStore().getCookies();
if(!cookies.isEmpty()) {
Log.d("log", "Empty not");
} else {
Log.d("log", "Empty");
}
이렇게 해서 로그인을 했습니다. 제대로 인증되었고요.
그래서 쿠키 저장해서... 웹뷰에서 써먹을려 하는데,
Log.v("log", responsePOST.getHeaders("Set-Cookie").toString());
이렇게 하면
03-15 07:54:35.863: V/log(1492): [Lorg.apache.http.Header;@44e83de0
이런게 찍힙니다.
그런데 밑에서 쿠키가 비어 있느냐? 그렇지 않느냐 하는 구문에서는 Empty 가 찍힙니다.
뭔가 빠졌는지? 아니면, 생각해봐야 될 부분이라든지.. 조언 부탁드립니다.




http://cdkkcdkktoandroid.tistory.com/14