• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving Cookies  RSS feed

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


headers returns

headers.get("Set-Cookie"); returns

But lc.getHeaderField("Set-Cookie"); returns

What happened to the rest ? Why is returning just one (the first) cookie ?

Moreover some servers respond by sending two Set-Cookie headers to inidicate 2 cookies (header, value) pairs.

Is there a simpler way to retrieve cookies in JDK 1.6 ?

Thanks
[ December 12, 2007: Message edited by: Anjanesh Lekshminarayanan ]
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the javadocs of the getHeaderField method:
If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned.

Check out the getHeaderFields method, which returns all values for a given header name.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!