Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 53092 invoked from network); 18 Jan 2010 10:52:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jan 2010 10:52:06 -0000 Received: (qmail 21674 invoked by uid 500); 18 Jan 2010 10:52:05 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 21583 invoked by uid 500); 18 Jan 2010 10:52:05 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 21573 invoked by uid 99); 18 Jan 2010 10:52:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jan 2010 10:52:05 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=SPF_PASS,STOX_REPLY_TYPE X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [131.239.30.132] (HELO ntmamx2.progress.com) (131.239.30.132) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jan 2010 10:51:54 +0000 Received: from ntmamx2.progress.com (127.0.0.1) by ntmamx2.progress.com (MlfMTA v3.2r9) id haguko0171s2 for ; Mon, 18 Jan 2010 05:51:36 -0500 (envelope-from ) Received: from progress.com ([172.16.3.168]) by ntmamx2.progress.com (SonicWALL 7.1.1.1995) with ESMTP; Mon, 18 Jan 2010 05:51:36 -0500 Received: from NTMAEXCAS02.bedford.progress.com (ntmaexcas02 [10.128.13.36]) by progress.com (8.13.8/8.13.8) with ESMTP id o0IApXdQ008380 for ; Mon, 18 Jan 2010 05:51:33 -0500 (EST) Received: from sberyoz (10.5.2.31) by NTMAEXCAS02.bedford.progress.com (10.128.13.37) with Microsoft SMTP Server (TLS) id 8.2.213.0; Mon, 18 Jan 2010 05:51:32 -0500 Message-ID: <019c01ca982c$329c0870$1f02050a@emea.progress.com> From: Sergey Beryozkin To: References: <025e01ca9531$8dc478c0$1f02050a@emea.progress.com> <010e01ca95f1$a89626b0$1f02050a@emea.progress.com> Subject: Re: Access to HTTP cookie values in Interceptor or Invoker implementation? Date: Mon, 18 Jan 2010 10:51:31 +0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3598 x-mimeole: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Mlf-Version: 7.1.1.1995 X-Mlf-UniqueId: o201001181051360479788 X-Virus-Checked: Checked by ClamAV on apache.org Hi > We have a single cookie header containing multiple values. > > Example: > Cookie=user_token_w=amsterdam@vicio.com|1295428834|7mMx6SxeIeSaWhygsOsAyA==|Iy/1xl/kOwderfdsdhAg/ip1Qsb0dwerQOJ8zDYJ34=; > user_logged_in=true > > I realized we are not encoding the cookie values,maybe this is the > problem... I'm going to try right now. Looks like the problem is that a ';' separator is used as a delimeter between multiple value, one cookie value is "user_token_w=amsterdam@vicio.com|1295428834|7mMx6SxeIeSaWhygsOsAyA==|Iy/1xl/kOwderfdsdhAg/ip1Qsb0dwerQOJ8zDYJ34=;" and another one is "user_logged_in=true" Is it possible for you to use a ',' as a separator ? Now, looking at [1] I can see "Cookie:" cookie-version 1*((";" | ",") cookie-value) so perhaps some cookies might contain a ',' as a separator between a version and the actual value, but all cookies I've seen so far do use ';'. Also, I fixed yesterday an issue with multiple Cookie headers not being handled properly. So, right now, you need to use a ',' just before user_logged_in=true and starting from 2.2.6 (due in few days or so) you'd be able to use multiple Cookie headers as well... cheers, Sergey [1] http://tools.ietf.org/html/rfc2965 > > > > Thanks, > V. > > On Fri, Jan 15, 2010 at 3:47 PM, Sergey Beryozkin wrote: > >> Hi, >> >> do you have multiple Cookie headers or a single Cookie containing multiple >> values : >> >> Cookie: a=b,c=d >> >> I can see a test confirming HttpHeaders.getCookies() returns a map >> containing two entries. >> Can you post a sample Cookie value I can add a test for ? >> >> thanks, Sergey >> >> >> The problem parsing multiple the header when having multiple cookies seems >>> to be present also when injecting the HttpHeaders headers. >>> headers.getCookies() returns only one cookie. >>> >>> Is there any Jira issue tracking this? >>> >>> >>> >>> Thanks, >>> V. >>> >>> On Thu, Jan 14, 2010 at 5:35 PM, Michael Guyver >> >wrote: >>> >>> 2010/1/14 Sergey Beryozkin : >>>> > Hi >>>> > >>>> > One can write either a CXF interceptor or CXF JAXRS RequestHandler >>>> filter, >>>> > please see >>>> > >>>> >>>> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-DifferencebetweenJAXRSfiltersandCXFinterceptors >>>> > >>>> > If you do JAX-RS only then writing a filter could be a simpler option, >>>> for >>>> > ex, one can have JAXRS HttpHeaders injected into a custom filter : >>>> > >>>> > @Context >>>> > private HttpHeaders headers; >>>> > >>>> > and then just do header.getCookies() in handleRequest(); >>>> > >>>> > Alternatively, if you prefer to write a CXF interceptor then you can >>>> get >>>> to >>>> > the cookies like this : >>>> > >>>> > String rawValue = new MetadataMap( >>>> > >>>> > (Map>>> > >>>> List>)message.get(Message.PROTOCOL_HEADERS)).getFirst("Cookie"); >>>> > >>>> > Cookie c = Cookie.valueOf(rawValue); >>>> > >>>> > Note that the CXF HTTP transport does not split multiple header values >>>> > (those separated by ',') so if the Cookie header contains multiple >>>> cookies >>>> > then you'd need to split thme first before doing >>>> Cookie.valueOf(rawValue); >>>> > >>>> > hope it helps, Sergey >>>> > >>>> >>>> Hi Sergey, >>>> >>>> That's great, thanks very much for your help! >>>> >>>> Cheers >>>> >>>> Michael >>>> >>>> >>> >