hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: setting Cookie as Object vs as Request Header
Date Wed, 29 Jun 2005 10:32:44 GMT
Hello Satish,

which version of HttpClient are you using?
Early 2.0 versions did always generate a cookie
header, even if one was set by the application.
That was changed several months ago. Please
make sure you are using the latest 2.0 version,
or the new 3.0 if that is an option for you.

hope that helps,

Satish Mittal <satish.mittal@gmail.com> 
29.06.2005 12:01
Please respond to
"HttpClient User Discussion"


setting Cookie as Object vs as Request Header


    I am implementing cookie based session maintenance. For testing, I
have 2 small client java apps built using HttpClient library, that
connect to my tomcat server. The 1st app connects to server, gets a
cookie and stores it somewhere as a string. The 2nd app takes that
cookie and *tries* to send that cookie. Now

1)  When i set a cookie in client request as:


it doesn't work; the cookie doesn't reach server.

2)  Whereas if i populate a cookie object like this and set it in
HttpState object:

Cookie ck1 = new

This cookie gets set in request and reaches the server.

Why doesn't the 1st scenario work? The problem in scenario 2 is that
my client will get the entire cookie string as input from somewhere,
which means i will have to parse that string to get various attribute
values to populate Cookie object. In Scenario 1 i wouldn't need all
these and i can just send the string as it is.

Thanks in advance!

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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message