Ernst,
I believe your HttpState instance gets garbage collected between the HTTP requests.
Simply keep a reference to the HttpState instance and your cookies will not go lost.
If my guess happens to be wrong, though, could you please produce the wire & debug log
of the session in question. Having the session log at my disposal I should be able to
tell what happens to those cookies
http://jakarta.apache.org/commons/httpclient/logging.html
Regards,
Oleg
-Original Message-
From: Ernst de Haan [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2003 18:00
To: [EMAIL PROTECTED]
Subject: SourceForge AddReleaseTask for Ant
Hi,
I'm working on a SourceForge AddReleaseTask for Apache Ant. After
successfully fighting some HTTPS issues, I'm now having some difficulties
with cookies. It seems my cookies are deleted spontaneously when I call
connection.executeMethod().
This is what my code does:
* Create HTTPConnection in constructor
* In login() create a GetMethod object and use it to connect to the
SourceForge site. Two cookies are received ('session_ser' and
'persist_session').
* Then in addRelease() I create a new GetMethod object and execute it on the
same HttpConnection object. Just before I call executeMethod() the state
still contains 2 cookies, and right after it it contains 0 cookies?!
Questions:
* Why would the cookies be deleted from my HttpState?
* Is it okay if I create 2 GetMethod objects or should I create one and then
recycle() it after the first call?
* If so, then how do I set the new URI in the GetMethod?
This is the current version of the source code:
http://people.freebsd.org/~znerd/AddReleaseTask.java
This is part of the output I get:
--
Executing request
"https://sourceforge.net/account/login.php?return_to=&form_loginname=znerd&form_pw=Lis9ardd&persistent_login=1&login=Login+With+SSL";.
Received 2 cookies.
Received cookie:
session_ser=zx%2FOvw2JGeJqUtX2SsFPPEufdXs1ecnResrJ4qvW64J3DO1UjOB9najRyGZHsVly%2F7%2FApd7J6HNaZzO47TBkuaT0juKf20pqVZSSAZh2eho%3D-f1aaa7e8388e50ea9141109cf59e213c
Received cookie: persist_session=Udl8pV2KlUs%3D
Logged in to SourceForge site as "znerd".
Creating release "0.126" for group 71598, package 71219.
Current cookie count is 2
Executing request
"http://sourceforge.net/project/admin/newrelease.php?group_id=71598&release_name=0.126&package_id=71219&submit=Create+This+Release";.
Current cookie count is 0
--
Hints are more than welcome!
Kind regards,
Ernst
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]