java session/cookies question

Status
Not open for further replies.

amirn

Smack-Fu Master, in training
97
Hi,
I need to retrieve data from a webpage, however I do not have direct URL, but I need to call 3 URLs in the same session to get to that page.
I was able to do it using C# using the CookieContainer class (I set each HttpWebRequest with the same CookieContainer object)

I need to do the same with Java, but I can't find a way that will work.
I tried using the URLConnection Class, but each call seems to start a new session and the cookies are not being transfered to the following call.

I also tried using the setRequestProperty("Cookie", "foo=bar") to set the same cookies to all my URLConnection objects, but still not working.

Any idea how to create (or simulate) 3 URL calls from the same browser windows in java code?

Thanks.
 
Status
Not open for further replies.