Hi all,

I'm generally open to compromises but if we have a "addCookie" method,
newcomers will definitely ask a "getCookie" one, and as several cookies can
have the same name, we'll open the Pandora box.

This is the whole purpose of the org.restlet.util.Series<E> class, to allow
getting the first cookie with a given name, or all cookie having the same
name, etc.

For now, I prefer imposing an additional learning step to new users rather
than giving the illusion of simplicity when the data structure is truly
complex. We also need to care for consistency across the whole API, which
has a high priority for me.

Let's see if this problem comes back again and again in the future. We can
also reconsider the whole approach for Restlet 2.0 if you want, maybe there
are radically different ways to solve this problem.

Best regards,
Jerome  

> -----Message d'origine-----
> De : Rob Heittman [mailto:[EMAIL PROTECTED] 
> Envoyé : vendredi 1 février 2008 19:58
> À : [email protected]
> Objet : Re: Adding Cookies to a Client Request
> 
> I really don't have a deep passion about this issue, but I 
> would just like to register the opinion that this often 
> triggers an avalanche of noise.  Once you include the add 
> method, someone else wants a remove method, etc. until you 
> have duplicated a large chunk of the collection API in the 
> container.  When you do this for enough collections contained 
> in fields, you have huge numbers of methods that do nothing 
> other than repeat the methods of the collection fields, which 
> can make a class's API largely unreadable.
> 
> Limiting the repetition to a specific common case (like add, 
> for cookies) seems a reasonable compromise.
> 
> - R
> 
> On 2/1/08, Stephan Koops <[EMAIL PROTECTED]> wrote:
> 
>       a possibility is to add for every setter/getter pait returning a
>       Collection (or List, Set, e.g.) an add method.
>       Example: add for Collection request.getCookies() and
>       request.setCookies(Collection) add a method 
> request.addCookie(Cookie).
>       
> 
> 
>  
> 

Reply via email to