You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Oleg Kalnichevski <o....@dplanet.ch> on 2003/03/06 21:07:58 UTC

Re: Cookies

Hi Steve

On Thu, 2003-03-06 at 17:00, Stephen Found wrote:
> Hi Oleg,
> 
> I hope you don't mind me emailing you directly but I could not find any
> way of submitting suggestions to the excellent Commons HttpClient
> project and I notice that you are one of the main contributors.
> 

Of course, I do not mind. However, the preferred way of addressing
HttpClient developers is through the HttpClient mailing list. 

http://jakarta.apache.org/commons/httpclient/mail-lists.html

By participating at the mailing list you can benefit from hearing
diverse opinions of all those involved in HttpClinet project. Besides,
there are people whose contribution to the HttpClient project far
exceeds mine. They may be in a by far better position to answer your
questions 


> The area I have in question is the support for HTTP Cookies. I note from
> the code that cookies are created for use solely by the Client using the
> internal org.apache.commons.httpclient.Cookie and
> javax.servlet.http.Cookie is not used at all. 
> 

That has been a conscious decision on the part of HttpClient developers.
Client-side cookies are different logical entities compared to
server-side cookies. Server-side cookies represent 'Set-Cookie' response
headers, whereas client-side cookies represent 'Cookie' request headers.
Besides, it doubt that tightly coupling HttpClient with
javax.servlet.http package would be such a great idea. However, I have
to assume that under your specific circumstances such design decision
may be justifiable. 


> What would be nice, is to have the Cookie defined as an interface rather
> than a concrete class. This would enable an end user ( eg Me :) ) to
> plug in their own cookie class which could for instance be an extended
> javax.servlet.http.Cookie class modified to fit the interface.
> 

This is as true as it is said. Clearly Cookie needs to be an interface.
I have been planning to introduce a new Cookie interface as I get down
to working on RFC 2965 support (Cookie2 spec). This refactoring has to
done after 2.0 release, though, as it would break API compatibility. 

Feel free to file a bug report to make sure that this suggestion does
not go forgotten

http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=HttpClient

Should you ever embark on such an undertaking as writing your own cookie
implementation, be warned, though, that you would also need to provide a
custom implementation of the CookieSpec interface capable of dealing
with your custom cookies. 

Cheers

Oleg