Dear Oleg,

Sorry for that I don't know how to use the logger to log the needed or 
important log for HttpClient. 
The website only demonstrate how to setup the configuration instead of how to 
use it for logging...

--
Dear Roland,

I know the cookie issue, and had already read the document you provide for me.

The prerequisite I forgot to tell you is that I connect and login to HTTPS page 
first, then I connect to HTTP page.

I am sure the server response a valid cookie because of the old code I wrote 
can work well.
The old code I use are HttpsURLConnection and HttpURLConnection . 
I get a cookie from HttpsURLConnection.getHeaderField(), then I set the cookie 
with HttpURLConnection.setRequestProperty() for next connection, and it works 
well.
Please note that the first one I use is HttpsURLConnection and the second one 
is HttpURLConnection.

Now when I transfer the old code to the new code with HttpClient, there is a 
cookie problem I can't figure out.
Does it mean if the protocol changed from HTTPS to HTTP, the connection session 
will be different from each other even if I use the same HttpClient instance?

The cookie content got from server is " [version: 0][name: JSESSIONID][name: 
8012FD6E805E69A2FAF5F463A8FA8281][domain: 192.168.20.73][path: /agent][expiry: 
null]" after the first login action.
The cookie content got from server is " [version: 0][name: JSESSIONID][name: 
D1CC1767F69A03AF99F8AC55C1DF1E0D][domain: 192.168.20.73][path: /agent][expiry: 
null]" after the second action.

Does it mean I need to set the previous cookie with the next 
HttpClient.execute(HttpPost, HttpContext), which HttpContext has the previous 
connection's cookie attribute?

Or even if the different protocol connections are proceed, the HttpClient still 
can handle the cookie issue, and I don't care how it works?

I think I need not to know which cookie version or protocol I receive or send 
because the HttpClient's default cookie policy is "Best Match", am I right?


Thanks for your kindly help.

Sincerely,
Micky

-----Original Message-----
From: Roland Weber [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 01, 2008 1:44 PM
To: HttpClient User Discussion
Subject: Re: cookie or session-id is different from the same HttpClient 
connection?!

micky wrote:
> Then I print out the cookies of the two connection, I found them are 
> different.
> 
> But the document said I don't need to care the cookie issue when I use
> HttpClient to login and continue browsing other pages.

You don't have to take care of the cookies, but you have to make
sure that the correct cookie policy is in place and that the
server doesn't send invalid cookies.

http://wiki.apache.org/HttpComponents/ForAbsoluteBeginners#head-1cf332662ef015b4aa19e06dc24c24e391ecda69

The cookie guide is for the old API, but the ideas are still the same.
The latest release of HttpClient has a "Best Match" cookie policy that
automatically determines the kind of cookie sent by the server.
http://hc.apache.org/httpclient-3.x/cookies.html

cheers,
   Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to