hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Sending cookies promiscuously
Date Sat, 13 Jun 2009 11:56:34 GMT
Sam Crawford wrote:
> Evening all,
> 
> Is there any way to configure a BasicClientCookie such that if the target
> domain for the cookie is unknown, it will be sent to any domain when
> executed with an HTTP request?
> 
> We've found that if we create a simple BasicClientCookie (setting only a
> name and value), add it to a BasicCookieStore, and then attach that cookie
> store to a HttpContext, the resulting request will not contain the cookie.
> Naturally I understand the reason for this, but I wondered if there was a
> way around it (perhaps such that if no domain is set, it sends it
> promiscously to anywhere).
> 
> Thanks,
> 
> Sam
> 

Hi Sam

You basically have to replace the BasicDomainHandler [1] with a custom 
implementation:
(1) implement a custom CookieAttributeHandler
(2) register it with the cookie spec of your choice instead of the 
default one.
(3) register the custom cookie spec with HttpClient

Hope this helps

Oleg

[1] 
http://hc.apache.org/httpcomponents-client/httpclient/xref/org/apache/http/impl/cookie/BasicDomainHandler.html


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message