Yes, it happens automatically. To select the cookie policy you want to use, you just have to use one of the constants from CookiePolicy class so that HttpClient will lookup in the registry to get the right implementation. In your case, HttpClient will use IgnoreSpec.
2013/3/16 Albek, Elli (contractor) <[email protected]> > Thanks. > > Does it make sense to set new IgnoreSpec() on the client as well, or > does it happen automatically when I set CookiePolicy.IGNORE_COOKIES? > > E > > > > -----Original Message----- > Francois-Xavier Bonnet > Sent: Friday, March 15, 2013 2:42 AM > To: HttpComponents Project > Subject: Re: Exception parsing cookies > > No, you also have to set a CookieStore in the HttpContext. The > attributes > in the HttpContext you pass as a parameter take precedence over the > default > ones so using an empty HttpContext does not help. Some details here: > http://hc.apache.org/httpcomponents-client-ga/tutorial/html/statemgmt.ht > ml#d5e818 > > Anyway, in your case the most efficient solution is to tell HttpClient > to > ignore cookies instead of creating a HttpContext that will never be > reused: > httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY, > CookiePolicy.IGNORE_COOKIES); > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
