Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   how to read multiple cookies in header (http://www.velocityreviews.com/forums/t147466-how-to-read-multiple-cookies-in-header.html)

tommydogs@sickoflosers.com 11-03-2005 10:04 PM

how to read multiple cookies in header
 
I am visiting a web page (via URLConnection) which is supposed to spit
out four cookies. Using the standard:

String cookie = conn.getHeaderField("Set-Cookie");

only gives me the last cookie in the header. I know I can manually
parse the header to extract multiple cookies, but does java (1.4.2)
provide for an easier way?


Benji 11-03-2005 10:20 PM

Re: how to read multiple cookies in header
 
tommydogs@sickoflosers.com, while high on whiteboard markers, wrote:
> I am visiting a web page (via URLConnection) which is supposed to spit
> out four cookies. Using the standard:


> String cookie = conn.getHeaderField("Set-Cookie");


> only gives me the last cookie in the header. I know I can manually
> parse the header to extract multiple cookies, but does java (1.4.2)
> provide for an easier way?


use getHeaderFields to get a map that gives you a list of fields for
each header.

The API documentation is your friend. =P

--
Of making better designs there is no end,
and much refactoring wearies the body.


All times are GMT. The time now is 09:20 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.