Java API Tutorial - Java CookieStore.getURIs()








Syntax

CookieStore.getURIs() has the following syntax.

List < URI > getURIs()

Example

In the following code shows how to use CookieStore.getURIs() method.

//w  w w .j  a  va  2 s  . c o m
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.CookieStore;
import java.net.URI;
import java.net.URL;
import java.util.List;

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();
    CookieStore cookieStore = cm.getCookieStore();
    
    
    List<URI> uriList =  cookieStore.getURIs();
  }
}