hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Fairley <alex.mail.l...@gmail.com>
Subject Fwd: Setting Cookie Policy
Date Tue, 12 Jul 2005 19:43:48 GMT
---------- Forwarded message ----------
From: Alexander Fairley <alex.mail.list@gmail.com>
Date: Jul 12, 2005 9:22 AM
Subject: Re: Setting Cookie Policy
To: Michael Becke <mbecke@gmail.com>


Thanks Mike, but I'm not entirely sure that what you are suggesting
works. Since we've built our own Cookie Management Layer, the best
solution for us at this point is to disable HttpClient's cookie
function completely. I'm attempting to do this by putting this in the
constructor for our HttpClientWrapper:
        CookiePolicy.registerCookieSpec(CookiePolicy.DEFAULT,

CookiePolicy.getCookieSpec(CookiePolicy.IGNORE_COOKIES).getClass());

which is what I put together based on the documentation's suggestion of:

        CookiePolicy.registerCookieSpec(CookiePolicy.DEFAULT, <Some
CookieSpec>);

Regarding your suggestion of :

        CookiePolicy.registerCookieSpec(CookiePolicy.DEFAULT,
IgnoreCookieSpec.class)

I've grepped in the rc3 source for IgnoreCookieSpec to no avail, so
I'm assuming that

IgnoreCookieSpec.class ==
CookiePolicy.getCookieSpec(CookiePolicy.IGNORE_COOKIES).getClass()

If this isn't the case, and IgnoreCookieSpec.class is different, do I
need to check out the source from subversion to get this object, or am
I just not finding it in rc3?

Thanks for your help,

Alexander



On 7/6/05, Michael Becke <mbecke@gmail.com> wrote:
> Hi Alexander,
>
> > According to the documentation, HttpClient follows the RFC_2109 cookie
> > ...
> > complaining every now and then about suspicious cookies. Also, once
> > I've figured out how to do this in the current code environment, I'll
> > write up some documentation that you folks can include for the next
> > guy to come along.
>
> Sounds like you want to try the compatibility (CookieSpecBase) policy.
>
> > How exactly does one set the client's cookie policy in the current environment?
>
> As per the cookie documentation
> <http://jakarta.apache.org/commons/httpclient/cookies.html>:
>
> Configuring per method:
> HttpMethod method = new GetMethod();
> method.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
> or
> method.getParams().setCookiePolicy(CookiePolicy.COMPATABILITY);
>
> Configuring globally:
> CookiePolicy.registerCookieSpec(CookiePolicy.DEFAULT, IgnoreCookieSpec.class)
> or
> CookiePolicy.registerCookieSpec(CookiePolicy.DEFAULT, CookieSpecBase.class)
>
> Mike
>

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


Mime
View raw message