Name: nt126004 Date: 08/31/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-be
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
(not importan for this request)
We are creating the Internet robot for the automatic accession of the Internet
pages, provided by http://public.celera.com/cds/login.cfm . This company
requires to use password to access the content of the pages. After submitting
the valid password it sets a cookie like jrunsessionid=997440358990209455 (the
number is different for each session) and requires this cookie for each later
accession. Otherwise, all you get is message "you must be logged to access this
page".
To use HttpURLConnection class, we would request a method to get a list of
cookies that were set during the connection, and other method to set a list of
cookies for the next connection, like:
String [] Cookies;
HttpURLConnection c1, c2;
c1 = ...
// connect and work with c1.
c1.close(); // after reading the page.
c2 = ...
c2.setCookies(c1.getCookies());
... connect and work with c2.
// c2 adds all cookies to its http request.
...
(Review ID: 131120)
======================================================================
- duplicates
-
JDK-4224548 HttpURLConnection needs support for cookies
-
- Closed
-