hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albek, Elli \(contractor\)" <ealbek-contrac...@shaklee.com>
Subject RE: Exception parsing cookies
Date Fri, 15 Mar 2013 09:28:25 GMT
Thanks,

To add, the code that use the client (called concurrently by many
threads):

HttpResponse response = client.execute(call);

HttpEntity entity = response.getEntity();
if (entity != null) {
  String body = EntityUtils.toString(entity);
  String mime = entity.getContentType().getValue();
  // process response ...
}

If we use new client.execute(call, new BasicHttpContext()) instead,
                                   ^^^^^^^^^^^^^^^^^^^^
   
is that going to create a transient storage for cookies that will not be
used between calls?

E



-----Original Message-----
 Francois-Xavier Bonnet
Sent: Thursday, March 14, 2013 9:55 PM
To: HttpComponents Project
Subject: Re: Exception parsing cookies

I guess the application you are calling is developed with Zend framework
and the framework is setting automatically this cookie. I don't know if
there is a way to remove it.

An HttpClient instance has a default CookieStore. If you don't set a
different HttpContext for each request with a CookieStore in it,
HttpClient
will use the same default CookieStore for all users. I think your
problem
comes from concurrent accesses to this CookieStore which is not thread
safe.

If you want to be stateless, I suggest that you set HttpClient to just
ignore all cookies, this should solve your problem:
httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY,
CookiePolicy.IGNORE_COOKIES);


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


Mime
View raw message