hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Terrell" <Steven.Terr...@guideworkstv.com>
Subject RE: managing cookies in threads
Date Wed, 05 Jul 2006 16:56:09 GMT
I have successfully managed cookies in threads. Your code shows setting
the cookie policy, but not setting any actual cookies.

I would suggest creating a new HostConfiguration and HttpState for every
executeMethod call, and use HttpClient.executeMethod(HostConfiguration,
GetMethod, HttpState). The cookies are stored in and retrieved from
HttpState. You will need to manage the storage of the cookies locally,
including how to retrieve the proper cookies to be used in the current
thread.

--Steve

-----Original Message-----
From: Eugeny N Dzhurinsky [mailto:bofh@redwerk.com] 
Sent: Wednesday, July 05, 2006 11:52 AM
To: httpclient-user@jakarta.apache.org
Subject: Re: managing cookies in threads

After performing some tests, I found cookies are not set back to server
at all
for some reason. I wire logs i can see something like

DEBUG 05/07/06 06:07:39 [Thread-3] (Wire:69) - << "Set-Cookie:
ASPSESSIONIDQSCQASSS=IFLMCPNBLHAKEFLOMPPCOMCM; path=/[\r][\n]"

And I assume this cookie is returned, but I can't see this cookie
is sent to server.

Code to retrieve page looks like:

get = new GetMethod();
get.setURI(uri);
get.setFollowRedirects(true);
HttpMethodParams p = get.getParams();
p.setVersion(new HttpVersion(1, 1));
p.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
http.executeMethod(get);

Do I miss something?
-- 
Eugene N Dzhurinsky

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


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