Java HttpCookie.getCommentURL()
Syntax
HttpCookie.getCommentURL() has the following syntax.
public String getCommentURL()
Example
In the following code shows how to use HttpCookie.getCommentURL() method.
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.HttpCookie;
import java.net.URL;
import java.util.List;
/*from ww w . j a va2 s. co m*/
public class Main {
public static void main(String[] args) throws Exception {
CookieManager cm = new CookieManager();
cm.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
CookieHandler.setDefault(cm);
new URL("http://google.com").openConnection().getContent();
List<HttpCookie> cookies = cm.getCookieStore().getCookies();
for (HttpCookie cookie : cookies) {
System.out.println(cookie.getCommentURL());
System.out.println();
}
}
}