File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes cookies in java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "cookies in java application" Watch "cookies in java application" New topic

cookies in java application

Jan Andersson

Joined: Nov 19, 2001
Posts: 5
I'm writing a small Java application that logs in to my webmail account and retrives the new message headers if any.
By http POSTing I've managed to log in but the webmail service relies on a cookie being present. So when I try to GET the page on which the new mails are listed thinks I'm logged out since it can't read the cookie.
How to I manage cookies in Java? It should be possible since there are Java web browsers (i think...).
Greatful for any tips and ideas!
/Jan Andersson

Joe Gilvary
Ranch Hand

Joined: May 11, 2001
Posts: 152
You pass cookies back and forth in HTTP headers.
Look at the examples in the old rfc at
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Hello Jan Andersson,

If you'd be willing, I'd appreciate a look at your code. That sounds like a great application to have.

Thank You,
-Dirk Schreckmann

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jan Andersson

Joined: Nov 19, 2001
Posts: 5
Aha, that RFQ should do it... So subsequent requests after logging in should include:


Dirk: No problem. But right now it doesn't do much besides logging in. I need to fix this cookie thing before seeing any results. I´┐Żll get back to you then.
[ February 22, 2002: Message edited by: Jan Andersson ]
I agree. Here's the link:
subject: cookies in java application
It's not a secret anymore!