hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ossf...@dubioso.net>
Subject Re: Question About Cookies
Date Wed, 05 Mar 2008 18:38:16 GMT
Hello Joan,

there is no need to shout.

> The question is: doing this, am I setting this cookie for all threads or
> just for the current thread that is executing this code?

For all threads.

> Obviously, I want
> to set this cookie just for the current thread, not for all. Is this
> correct? And if not, how should I do it?

You should have a separate HttpState object for each thread
instead of using the default HttpState object for all of them:
http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpClient.html#executeMethod(org.apache.commons.httpclient.HostConfiguration,%20org.apache.commons.httpclient.HttpMethod,%20org.apache.commons.httpclient.HttpState)

> And the following question is: this request is sent to another servlet, that
> reads it. But if I examine the HttpServletRequest, I always get null for
> cookies attribute. It’s like httpclient is not including the cookie in the
> request I’m sending to the remote servlet.

Check the domain and path attributes of your cookie.
Enable wire logging to see wether the cookie is sent or not.
http://hc.apache.org/httpclient-3.x/logging.html

hope that helps,
   Roland


---------------------------------------------------------------------
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