aspose file tools*
The moose likes Servlets and the fly likes Help with servlet useing cookie to read a webpage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help with servlet useing cookie to read a webpage" Watch "Help with servlet useing cookie to read a webpage" New topic
Author

Help with servlet useing cookie to read a webpage

Chaz Andrews
Greenhorn

Joined: Sep 20, 2005
Posts: 23
Hi, Im trying to get my servlet to access and download a page. The page requires a cookie to access it tho. Can a servlet use a cookie to access other webpages? Any info is appreciated.
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Yes, if you know cookie name and value then just set them when you open URL connection.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Here is an example of setting a JSEESIONID which is just
a cookie as far as HTTP is concerned.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Chaz Andrews
Greenhorn

Joined: Sep 20, 2005
Posts: 23
Originally posted by Ben Souther:
Here is an example of setting a JSEESIONID which is just
a cookie as far as HTTP is concerned.


Bimey, that was easier than I expected it to be. Cheers guys
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with servlet useing cookie to read a webpage