|
Oct
01
|
Cookies are specified in the response header keyed on ‘Set-Cookie’ so the getHeaderFields() method of URLConnection can be used to retrieve them.
URLConnection conn = new url.openConnection();
Map<String,List<String>> headers = conn.getHeaderFields();
List<String> cookies = headers.get("Set-Cookie");
for (String cookie: cookies)
{
System.out.println(cookie);
}



Recent Comments