List of usage examples for java.net CookiePolicy ACCEPT_ORIGINAL_SERVER
CookiePolicy ACCEPT_ORIGINAL_SERVER
To view the source code for java.net CookiePolicy ACCEPT_ORIGINAL_SERVER.
Click Source Link
From source file:Main.java
public static void main(String[] args) throws Exception { CookieManager cm = new CookieManager(); cm.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER); CookieHandler.setDefault(cm); new URL("http://google.com").openConnection().getContent(); List<HttpCookie> cookies = cm.getCookieStore().getCookies(); for (HttpCookie cookie : cookies) { System.out.println("Name = " + cookie.getName()); System.out.println("Value = " + cookie.getValue()); System.out.println("Lifetime (seconds) = " + cookie.getMaxAge()); System.out.println("Path = " + cookie.getPath()); System.out.println();//from w w w.ja v a2s. c o m } }
From source file:se.leap.bitmaskclient.ProviderAPI.java
@Override public void onCreate() { super.onCreate(); preferences = getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE); CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ORIGINAL_SERVER)); }