users@jersey.java.net

Re: Request new feature: _at_CookieParam

From: Jose Antonio Illescas del Olmo <jose.illescas_at_gmail.com>
Date: Wed, 9 Jan 2008 13:13:25 +0100

On Jan 9, 2008 12:39 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:

> Hi Jose,
>
> If you subscribe to the users list i don't have to CC you on the replies
> (something that i can easily forget to do) :-)
>

Sorry, currently subscribed...

>
>
> Jose Antonio Illescas del Olmo wrote:
> > This annotation allow access to cookie value (from his name)
> >
> > Usage:
> >
> > @GET public String foo(@CookieParam("name") String value){
> > // do something
> > }
>
>
> Currently the approach to @*Param has been for general stuff, Path,
> Query and Header and not specific to a certain type.
>
> The current way to access the set of cookies sent by a client is to do
> the following:
>
> @GET public String foo(@HttpContext HttpHeaders headers){
> List<Cookie> cookies = headers.getCookies();
> }
>
> but this does mean you have to traverse the list yourself to find one or
> more cookies with the name you are interested in.
>
> Perhaps we should return a MultivaluedMap [1] instead? I would prefer
> that solution to creating a specific annotation.
>

I suppose so.
I prefer MultivaluedMap over List (to avoid traverse the list over and over
again)


>
> Paul.
>
> [1]
>
> https://jsr311.dev.java.net/nonav/releases/0.5/javax/ws/rs/core/MultivaluedMap.html
> --
> | ? + ? = To question
> ----------------\
> Paul Sandoz
> x38109
> +33-4-76188109
>