commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: [HttpClient] Callback when accepting a cookie?
Date Mon, 24 Oct 2005 18:07:11 GMT
On Mon, 2005-10-24 at 19:49 +0200, Uwe Seimet wrote:
> Hello Oleg,
> 
> > The recommend way to customize the cookie management with HttpClient is
> > to provide a custom cookie policy or extend an existing one [1]. 
> > 
> > However, if the existing plug-in mechanism does not fully cover your
> > requirements, feel free to file an enhancement request in Bugzilla. We
> > can consider such an extension for inclusion into the 3.1 release
> 
> The current functionality is probably sufficient for my purpose, but I
> am not sure how to best implement what I need. My guess is that in order
> for my application to be called back when a cookie is accepted I would have
> to extend the BROWSER_COMPATIBILITY cookie policy, because this is the one
> I am currently using in my application.
> What I do not see, though, is the relationship between the cookie policy
> string, which is set with setCookiePolicy(), and the class implementing
> the CookieSpec interface. Overriding the validate() call of this class is
> what I think I need, but which of the CookieSpec implementation would I
> inherit from?
> Can you give me some advice? Thank you.
> 
> Best regards,  Uwe
> 

Uwe,
If your application exclusively uses BROWSER_COMPATIBILITY policy, you
can simply extend the CookieSpecBase class, override the validate method
and register your custom cookie spec with the CookiePolicy class as the
default one. In case you want to support any arbitrary cookie policy
consider extending the HttpState class and overriding
HttpState#addCookie instead.

Hope this helps.

Oleg

> --
> -----------------------------------------------------------------------
>   Dr. Uwe Seimet                                 http://www.seimet.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message