Listing 2: ExtractCookies2.java
import java.net.*;
import java.io.*;
import java.util.*;

class read{

public read(){}

BufferedReader buffer=null;      
String linie=null;
HttpURLConnection URLcon=null;
URL url=null;
InputStream IS=null;
int cookie_nr=0;

public void getURLContent()
            {   
		try {
                //optional  - for proxy connection used  
                InetAddress addr=InetAddress.getByName("www-proxy.petrom.com");
                InetSocketAddress ISA=new InetSocketAddress(addr,8080);
                java.net.Proxy proxy=new java.net.Proxy(java.net.Proxy.Type.HTTP,ISA);
                
                url=new URL("http://www.DevX.com");     
                URLcon = (HttpURLConnection)url.openConnection(proxy);
                URLcon.connect();
                
                Map<String,List<String>> headers=URLcon.getHeaderFields(); 
                List<String> values = headers.get("Set-Cookie"); 
                Iterator iter=values.iterator(); 
                while(iter.hasNext())
                {
                cookie_nr++;
                System.out.println("\nCookie  :"+cookie_nr);  
                String v = (String)iter.next(); 
                
                StringTokenizer STsemi_colons=new StringTokenizer(v,";");
                while(STsemi_colons.hasMoreTokens())
                      {                                
                      String pair=STsemi_colons.nextToken();
                      StringTokenizer STequal=new StringTokenizer(pair,"=",true); 
                      System.out.print("\nName:"+STequal.nextToken()+"   Value");
                      while(STequal.hasMoreTokens())
                           System.out.print(STequal.nextToken());
						    }
                }
                
                }catch(MalformedURLException e)
		 	    {System.out.println("Eroare:"+e.getMessage());
                }catch(IOException e)
                      {System.out.println("Eroare:"+e.getMessage());}   
           }
}

public class ExtractCookies2{
	public static void main(String[] args) 
	 {
	read t=new read();
      t.getURLContent();
	}
}

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.