Help with cookies and HTML
I'm trying to write some java code to log into a web page. I have my code working for pages that don't require cookies. I am looking to implement the ability to handle cookies so that I can log into a webpage that uses cookies. I read the "Working with Cookies" tutorial on this site, but it hasn't helped me too much. I don't quite understand how to correctly set up a CookieStore, CookieHandler, and CookieManager. I guess my question would be, how do these relate to each other and what is the simplest way to implement basic cookie handling in my java program?
Thanks in advance!
[600 byte] By [
mikekbrada] at [2007-11-27 11:00:09]

You can use HttpURLConnection to read a file from a web site. The class allows you so set the http headers. A Cookie is simply a header record sent with the http request. Here is an example of setting up some headers. Its not a valid example. It just shows that the properties are just key/value strings.
URL url = new URL(...);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestProperty("Accept-Language", "en-ca");
conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
conn.setRequestProperty("Cookie", "the cooke data goes here"");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.connect();