Home > Back-end >  The server returns the cookie information not to use the response to this object to accept? Why the
The server returns the cookie information not to use the response to this object to accept? Why the

Time:10-06

Get the Cookies method
Public void testGetCookies () throws IOException {

The String result;
//stitching test url from configuration file
String uri=bundle. Get String (" getCookies. Uri ");
String testUrl=this. Url + uri;

//test logic code written
HttpGet get=new HttpGet (testUrl);
DefaultHttpClient client =new DefaultHttpClient ();
HttpResponse response=client. The execute (get);
Result=EntityUtils. ToString (response. GetEntity (), "utf-8");
System. The out. Println (result);

//get the cookies information
this. Store=client. GetCookieStore ();
List CookieList=store. GetCookies ();

For (cookies, cookies: cookieList) {
String name=cookies. GetName ();
String value=(https://bbs.csdn.net/topics/cookie.getValue);
System. Out.println (" cookie name="+ name
+ "; The cookie value="HTTP://https://bbs.csdn.net/topics/+ value);
}
}

This is a method for cookies, I want to ask why I BiaoYong these two code is not through the response. GetCookieStore () to obtain a cookie information but with the clent. GetCookieStore () to obtain? The response is returned interface to access server to get cookies, and clent this object did not receive returned to the server to the information, it's all part of DefaultHttpClient new object is responsible for executing sends the request, there should be no cookies to ah why can get returned to the server to the cookie information
  • Related