how to read multiple cookies in header

Discussion in 'Java' started by tommydogs@sickoflosers.com, Nov 3, 2005.

  1. Guest

    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?
     
    , Nov 3, 2005
    #1
    1. Advertising

  2. Benji Guest

    , 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.
     
    Benji, Nov 3, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Nitulescu

    Response.Cookies vs Request.Cookies

    Alex Nitulescu, Feb 3, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    8,626
    Hans Kesting
    Feb 3, 2005
  2. Andy Fish
    Replies:
    3
    Views:
    6,608
    Fredrik Lindner
    Nov 6, 2003
  3. _Who
    Replies:
    7
    Views:
    2,774
  4. mlt
    Replies:
    2
    Views:
    912
    Jean-Marc Bourguet
    Jan 31, 2009
  5. bb
    Replies:
    0
    Views:
    590
Loading...

Share This Page