我正在为 Android 编写一个程序,它将一些发送POST
到 webService, HttpClient
如下所示:
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://example.com/service");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("email", email));
nameValuePairs.add(new BasicNameValuePair("password", password));
// Execute HTTP Post Request
ResponseHandler<String> responseHandler=new BasicResponseHandler();
String response = httpclient.execute(httppost , responseHandler) ;
我试图检索一个名为“Form”的“www.example.com”cookie,如下所示:
`
Log.d("Cookie0" , httpclient.getCookieStore().getCookies().get(0).getValue()) ;
Log.d("Cookie1", CookieManager.getInstance().getCookie("http://example.com"));
但是检索 cookie 的两种方法会为“Form”返回两个不同的值!为什么?