-1

Maybe this is a simple question or maybe a tough one I don't really know... I have a session opened in a web that requires a login. What I want to get is the content of the session cookie that has been generated and that my browser (Firefox in this particular case) has stored.

Is there any way to do this with an java application?

a.ras2002
  • 385
  • 2
  • 7
  • 21
  • Not enough information. What does java have to do with any of this? Are you a servlet app? an applet? – bmargulies Aug 15 '16 at 16:02
  • I have done a Java application that needs the content of that cookie in order to ask for several pages to the server and download the content of that pages and do some post-process with the data. And I don't want to copy manually the content of that cookie in my program every time that I access the page, so that's why I ask if there is any way to know that cookie automatically by doing something with Java (maybe a httpconnection or something like that...) – a.ras2002 Aug 15 '16 at 16:05

2 Answers2

0

You should be able to do this using CookieManager and CookieStore.

FredK
  • 4,094
  • 1
  • 9
  • 11
  • Thanks for the answer but if I use the CookieManager and CookieStore I don't get all the cookies... only the ones that appears without login into the web, not the ones that came with the session ID – a.ras2002 Aug 15 '16 at 16:25
0

Just look for the "Set-Cookie" headers coming through over the wire. It's unclear what Java framework you're using, but you should be able to see this in the request response.

Joseph Lust
  • 19,340
  • 7
  • 85
  • 83