hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Understanding cookie handling - registering cookies returned in a response
Date Wed, 20 Jul 2011 14:03:07 GMT
On Wed, 2011-07-20 at 11:25 +0200, Villemos, Gert wrote:
> Well, I dont understand cookie handling. I have read the very detailed
> guide at
> http://hc.apache.org/httpcomponents-client-ga/tutorial/pdf/httpclient-tu
> torial.pdf and a lot of posts, but I still don't get it.
> 
> In understand that you typically have a cookie store maintaining the
> session cookies, that you set on the client / context.
> 
> What I don't get is this; 
> 1. What is the difference between setting the cookie store on the client
> and on the context?

Global cookie store is shared by all threads or execution / users, where
as cookie store set in the local context can be used by one thread /
user. 


> 2. When I have set a cookiestore (on client and context) and execute a
> post that returns a response with cookies (such as JSESSIONID), then I
> would expect those cookies to be registered automatically in the cookie
> store for usage in the next request... but they aint (store is empty,
> see below).

The cookie sent by the server violates the HTTP state management spec
and apparently gets rejected.

You can use context / wire logging to find out whether or not the
cookie(s) have been rejected. 

> 3. Do I need to register the cookies manually and how do I do this?
> 

RFC_2965 policy is very strict. Use BEST-MATCH policy instead. It will
automatically pick up Netscape compatible cookie spec to handle cookies
containing legacy 'Expires' attribute.

Hope this helps

Oleg



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