A Useful Java Tool For Storing Cookies

cookieI had this post on how to login to sites using Java’s URL and HttpURLConnection classes and how there is no need to manually store a cookie’s information and pass it to every other URL you intend to visit that requires a login if it cannot find the cookie information. This neat Cookie utility by Saar Machtinger handles all storing of cookie information after you log in to a site. It only needs to read the the contents of the HttpURLConnection variable after it has successfuly posted a request to login.

Then, once you have the CookieTool variable in hand with the cookie information like session id among others, you can access any url of that certain site which you logged in to. To do so, simply do this (ct is the CookieTool variable).

This is the CookieTool class by the way.

Related Posts Plugin for WordPress, Blogger...

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *