users@jersey.java.net

Re: Request new feature: _at_CookieParam

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 02 Apr 2008 14:17:31 +0200

Hi,

The 311 EG agreed to @javax.ws.rs.CookieParam. Support is now in the trunk.

Paul.

Jose Antonio Illescas del Olmo wrote:
>
>
> On Jan 9, 2008 12:39 PM, Paul Sandoz <Paul.Sandoz_at_sun.com
> <mailto: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
>
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109