package com.mindprod.example;
import java.applet.Applet;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.CookieStore;
import java.net.HttpCookie;
import static java.lang.System.*;
/**
* Example use of ability of Applet to look at cookies with java.net.CookieHandler.
* <p/>
* Requires JDK 1.8+
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2009-01-01 initial version
* @since 2009-01-01
*/
public final class TestCookie extends Applet
{
/**
* Called by the browser or Applet viewer to inform
* this Applet that it has been loaded into the system.
*/
@Override
public void init()
{
out.println( "init called" );
final CookieManager cm = new CookieManager( null , CookiePolicy.ACCEPT_ALL );
CookieHandler.setDefault( cm );
final CookieStore cs = cm.getCookieStore();
for ( HttpCookie hc : cs.getCookies() )
{
out.println( hc.toString() );
}
this.validate();
this.setVisible( true );
}
}