aspose file tools
The moose likes Java in General and the fly likes Retrieving Cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Retrieving Cookies" Watch "Retrieving Cookies" New topic
Author

Retrieving Cookies

Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
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 ]

Anjanesh Lekshminarayanan
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35253
    
    7
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.


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Retrieving Cookies
 
Similar Threads
problem without logout, how to solve it
HTTPURLCONNECTION
Identical request in browser and Java with different responses, why does this happen?
Getting Response Headers
HttpUrlConnection: Login works only for first page