users@jersey.java.net

Re: Request new feature: _at_CookieParam

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 09 Jan 2008 12:39:49 +0100

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) :-)


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.

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