Cookie problems submitting a https form using java

Hi,

I've been trying to use java to submit a form via https, and the connection is fine, but the form i am trying to emulate has a cookie checker that will redirect you to an error page if you don't have cookies enabled. Now I looked at the cookies for the page in firefox, and it looks like the cookie I want to use is called:

AD_TEST_COOKIES, which has an expiration of Session,

now for some reason, when I set the request header, i still get redirected incorrectly.. this is the code I'm using:

conn.setRequestHeader("Set-Cookie","AD_TEST_COOKIES=1");

I've also tried various variations such as:

conn.setRequestHeader("Cookie","AD_TEST_COOKIES=1");

conn.setRequestHeader("Set-Cookie","AD_TEST_COOKIES=1; path=/; domain=.site.com; expires=Sun, 17-Jan-2038 19:14:07 GMT");

conn.setRequestHeader("Set-Cookie","AD_TEST_COOKIES=1; path=/; domain=.site.com; expires=session);

etc..

None of them seemed to work... is there something else that I should be doing? Or is there another name I should use to identify the cookie beside "Set cookie" and "cookie"?

Thanks a bunch for your help

[1365 byte] By [Vasant56a] at [2007-11-26 20:18:09]
# 1
If you are using JDK1.6 then take a look at java.net.CookieManager .
sabre150a at 2007-7-10 0:41:33 > top of Java-index,Core,Core APIs...
# 2
Sorry, I should have mentioned i'm using a limited API, and only have access to setrequestheader
Vasant56a at 2007-7-10 0:41:33 > top of Java-index,Core,Core APIs...
# 3
> Sorry, I should have mentioned i'm using a limited> API, and only have access to setrequestheader http://www.ietf.org/rfc/rfc2965.txt may be applicable.
sabre150a at 2007-7-10 0:41:33 > top of Java-index,Core,Core APIs...
# 4
Hi thanks a lot for the help, but unfortunately it didn't work. Do you have any other ideas? How should I set a session expiry?Thanks again
Vasant56a at 2007-7-10 0:41:33 > top of Java-index,Core,Core APIs...
# 5
Would you happen to have an e-mail so I can discuss the specific form I'm trying to emulate in private?Thanks
Vasant56a at 2007-7-10 0:41:33 > top of Java-index,Core,Core APIs...
# 6
> Hi thanks a lot for the help, but unfortunately it> didn't work. Do you have any other ideas? How should> I set a session expiry?Sorry, I can't help with this.
sabre150a at 2007-7-10 0:41:33 > top of Java-index,Core,Core APIs...