gagneet wrote:
Hi Oleg,
Thanks for your inputs. Now I am making a new HttpState object for each request made. But have found a new problem. This problem occurs when the requests are concurrent. What is evident is that after redirection happens the JSESSIONID of both the requests become same. Could not figure out what makes the JSESSIONID for one request to be overwritten by JSESSIONID of second request. I am using singleton HttpClient object which is created using MultiThreadedHttpConnectionManager.

You are passing HttpState as a parameter to the HttpClient#executeMethod, aren't you?

Oleg



  Please find the wire logs below.
[4/2/08 10:51:43:978 IST] 2ff8605c SystemErr R 2008/04/02 10:51:43:978 IST [DEBUG] MultiThreadedHttpConnectionManager - HttpConnectionManager.getConnection: config = HostConfiguration[host=https://uat.abc.def.ghi], timeout = 0
[4/2/08 10:51:43:978 IST] 237a6051 SystemErr     R 2008/04/02 10:51:43:978 IST 
[DEBUG] MultiThreadedHttpConnectionManager - 
HttpConnectionManager.getConnection:  config = 
HostConfiguration[host=https://uat.abc.def.ghi], timeout = 0
[4/2/08 10:51:43:993 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:43:993 IST 
[DEBUG] MultiThreadedHttpConnectionManager - Allocating new connection, 
hostConfig=HostConfiguration[host=https://uat.abc.def.ghi]
[4/2/08 10:51:43:993 IST] 237a6051 SystemErr     R 2008/04/02 10:51:43:993 IST 
[DEBUG] MultiThreadedHttpConnectionManager - Allocating new connection, 
hostConfig=HostConfiguration[host=https://uat.abc.def.ghi]
[4/2/08 10:51:43:993 IST] 237a6051 SystemErr     R 2008/04/02 10:51:43:993 IST 
[DEBUG] HttpConnection - Open connection to uat.abc.def.ghi:443
[4/2/08 10:51:43:993 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:43:993 IST 
[DEBUG] HttpConnection - Open connection to uat.abc.def.ghi:443
[4/2/08 10:51:44:103 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:44:103 IST [DEBUG] header - >> 
"GET 
/servlet/com.ghi.selflink.servlet.SelfLinkServlet?param1=N&param2=ABCD1265447019&param3=KVWWDNMM&param4=I
 HTTP/1.1[\r][\n]"
[4/2/08 10:51:44:103 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:44:103 IST 
[DEBUG] HttpMethodBase - Adding Host request header
[4/2/08 10:51:44:118 IST] 237a6051 SystemErr     R 2008/04/02 10:51:44:118 IST [DEBUG] header - >> 
"GET 
/servlet/com.ghi.selflink.servlet.SelfLinkServlet?param1=N&param2=ABCD1231231232&param3=HGJFKDIR&param4=I
 HTTP/1.1[\r][\n]"
[4/2/08 10:51:44:118 IST] 237a6051 SystemErr     R 2008/04/02 10:51:44:118 IST 
[DEBUG] HttpMethodBase - Adding Host request header
[4/2/08 10:51:44:134 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:44:134 IST [DEBUG] header - 
>> "User-Agent: Jakarta Commons-HttpClient/3.0[\r][\n]"
[4/2/08 10:51:44:134 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:44:134 IST [DEBUG] header - 
>> "Host: uat.abc.def.ghi[\r][\n]"
[4/2/08 10:51:44:134 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:44:134 IST [DEBUG] header - 
>> "[\r][\n]"
[4/2/08 10:51:44:134 IST] 237a6051 SystemErr     R 2008/04/02 10:51:44:134 IST [DEBUG] header - 
>> "User-Agent: Jakarta Commons-HttpClient/3.0[\r][\n]"
[4/2/08 10:51:44:134 IST] 237a6051 SystemErr     R 2008/04/02 10:51:44:134 IST [DEBUG] header - 
>> "Host: uat.abc.def.ghi[\r][\n]"
[4/2/08 10:51:44:134 IST] 237a6051 SystemErr     R 2008/04/02 10:51:44:134 IST [DEBUG] header - 
>> "[\r][\n]"
[4/2/08 10:51:45:775 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:775 IST [DEBUG] header - 
<< "HTTP/1.1 302 Found[\r][\n]"
[4/2/08 10:51:45:775 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:775 IST [DEBUG] header - 
<< "HTTP/1.1 302 Found[\r][\n]"
[4/2/08 10:51:45:775 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:775 IST [DEBUG] header - 
<< "Date: Wed, 02 Apr 2008 05:24:38 GMT[\r][\n]"
[4/2/08 10:51:45:775 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:775 IST [DEBUG] header - 
<< "Date: Wed, 02 Apr 2008 05:24:38 GMT[\r][\n]"
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:775 IST [DEBUG] header - 
<< "Server: IBM_HTTP_Server[\r][\n]"
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Server: IBM_HTTP_Server[\r][\n]"
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Set-Cookie: JSESSIONID=0000GV6ablUJRVpGEyoZghOmPO5:-1;Path=/[\r][\n]"
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Set-Cookie: JSESSIONID=0000htQCWkn5-9X9ZXuqlf6W9AW:-1;Path=/[\r][\n]"
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Pragma: No-cache[\r][\n]"
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Pragma: No-cache[\r][\n]"
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Cache-Control: no-cache[\r][\n]"
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Cache-Control: no-cache[\r][\n]"
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]"
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]"
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Location: 
https://uat.abc.def.ghi/index/regdto.jsp;jsessionid=0000GV6ablUJRVpGEyoZghOmPO5:-1[\r][\n]";
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Location: 
https://uat.abc.def.ghi/index/regdto.jsp;jsessionid=0000htQCWkn5-9X9ZXuqlf6W9AW:-1[\r][\n]";
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Content-Length: 0[\r][\n]"
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Content-Length: 0[\r][\n]"
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Content-Type: text/html; charset=ISO-8859-1[\r][\n]"
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Content-Type: text/html; charset=ISO-8859-1[\r][\n]"
[4/2/08 10:51:45:790 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Content-Language: en-US[\r][\n]"
[4/2/08 10:51:45:790 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:790 IST [DEBUG] header - 
<< "Content-Language: en-US[\r][\n]"
[4/2/08 10:51:45:868 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:868 IST [DEBUG] 
HttpMethodBase - Cookie accepted: "$Version=0; 
JSESSIONID=0000htQCWkn5-9X9ZXuqlf6W9AW:-1; $Path=/"
[4/2/08 10:51:45:868 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:868 IST [DEBUG] 
HttpMethodBase - Cookie accepted: "$Version=0; 
JSESSIONID=0000GV6ablUJRVpGEyoZghOmPO5:-1; $Path=/"
[4/2/08 10:51:45:868 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodDirector - Redirect required
[4/2/08 10:51:45:868 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodDirector - Redirect required
[4/2/08 10:51:45:868 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodDirector - Redirect requested to location 
'https://uat.abc.def.ghi/index/regdto.jsp;jsessionid=0000GV6ablUJRVpGEyoZghOmPO5:-1'
[4/2/08 10:51:45:868 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodDirector - Redirect requested to location 
'https://uat.abc.def.ghi/index/regdto.jsp;jsessionid=0000htQCWkn5-9X9ZXuqlf6W9AW:-1'
[4/2/08 10:51:45:868 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodDirector - Redirecting from 
'https://uat.abc.def.ghi:443/servlet/com.ghi.selflink.servlet.SelfLinkServlet' 
to 
'https://uat.abc.def.ghi/index/regdto.jsp;jsessionid=0000GV6ablUJRVpGEyoZghOmPO5:-1
[4/2/08 10:51:45:868 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodDirector - Redirecting from 
'https://uat.abc.def.ghi:443/servlet/com.ghi.selflink.servlet.SelfLinkServlet' 
to 
'https://uat.abc.def.ghi/index/regdto.jsp;jsessionid=0000htQCWkn5-9X9ZXuqlf6W9AW:-1
[4/2/08 10:51:45:868 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodDirector - Execute redirect 1 of 100
[4/2/08 10:51:45:868 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodDirector - Execute redirect 1 of 100
[4/2/08 10:51:45:868 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodBase - Resorting to protocol version default close connection 
policy
[4/2/08 10:51:45:868 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodBase - Resorting to protocol version default close connection 
policy
[4/2/08 10:51:45:868 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodBase - Should NOT close connection, using HTTP/1.1
[4/2/08 10:51:45:868 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:868 IST 
[DEBUG] HttpMethodBase - Should NOT close connection, using HTTP/1.1
[4/2/08 10:51:45:884 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "GET /index/regdto.jsp;jsessionid=0000GV6ablUJRVpGEyoZghOmPO5:-1 
HTTP/1.1[\r][\n]"
[4/2/08 10:51:45:884 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "GET /index/regdto.jsp;jsessionid=0000htQCWkn5-9X9ZXuqlf6W9AW:-1 
HTTP/1.1[\r][\n]"
[4/2/08 10:51:45:884 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:884 IST 
[DEBUG] HttpMethodBase - Adding Host request header
[4/2/08 10:51:45:884 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:884 IST 
[DEBUG] HttpMethodBase - Adding Host request header
[4/2/08 10:51:45:884 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "User-Agent: Jakarta Commons-HttpClient/3.0[\r][\n]"
[4/2/08 10:51:45:884 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "User-Agent: Jakarta Commons-HttpClient/3.0[\r][\n]"
[4/2/08 10:51:45:884 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "Host: uat.abc.def.ghi[\r][\n]"
[4/2/08 10:51:45:884 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "Host: uat.abc.def.ghi[\r][\n]"
[4/2/08 10:51:45:884 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "Cookie: $Version=0; JSESSIONID=0000htQCWkn5-9X9ZXuqlf6W9AW:-1; 
$Path=/[\r][\n]"
[4/2/08 10:51:45:884 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "Cookie: $Version=0; JSESSIONID=0000htQCWkn5-9X9ZXuqlf6W9AW:-1; 
$Path=/[\r][\n]"
[4/2/08 10:51:45:884 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "[\r][\n]"
[4/2/08 10:51:45:884 IST] 237a6051 SystemErr     R 2008/04/02 10:51:45:884 IST [DEBUG] header - 
>> "[\r][\n]"
[4/2/08 10:51:46:009 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:009 IST [DEBUG] header - 
<< "HTTP/1.1 200 OK[\r][\n]"
[4/2/08 10:51:46:009 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:009 IST [DEBUG] header - 
<< "Date: Wed, 02 Apr 2008 05:24:39 GMT[\r][\n]"
[4/2/08 10:51:46:009 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:009 IST [DEBUG] header - 
<< "Server: IBM_HTTP_Server[\r][\n]"
[4/2/08 10:51:46:009 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:009 IST [DEBUG] header - 
<< "Transfer-Encoding: chunked[\r][\n]"
[4/2/08 10:51:46:009 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:009 IST [DEBUG] header - 
<< "Content-Type: text/html;charset=ISO-8859-1[\r][\n]"
[4/2/08 10:51:46:009 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:009 IST [DEBUG] header - 
<< "Content-Language: en-US[\r][\n]"
[4/2/08 10:51:46:056 IST] 237a6051 SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] HttpMethodBase - Resorting to protocol version default close connection 
policy
[4/2/08 10:51:46:056 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] HttpMethodBase - Resorting to protocol version default close connection 
policy
[4/2/08 10:51:46:056 IST] 237a6051 SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] HttpMethodBase - Should NOT close connection, using HTTP/1.1
[4/2/08 10:51:46:056 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] HttpMethodBase - Should NOT close connection, using HTTP/1.1
[4/2/08 10:51:46:056 IST] 237a6051 SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] HttpConnection - Releasing connection back to connection manager.
[4/2/08 10:51:46:056 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] HttpConnection - Releasing connection back to connection manager.
[4/2/08 10:51:46:056 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] MultiThreadedHttpConnectionManager - Freeing connection, 
hostConfig=HostConfiguration[host=https://uat.abc.def.ghi]
[4/2/08 10:51:46:056 IST] 237a6051 SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] MultiThreadedHttpConnectionManager - Freeing connection, 
hostConfig=HostConfiguration[host=https://uat.abc.def.ghi]
[4/2/08 10:51:46:056 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] IdleConnectionHandler - Adding connection at: 1207113706056
[4/2/08 10:51:46:056 IST] 2ff8605c SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] MultiThreadedHttpConnectionManager - Notifying no-one, there are no 
waiting threads
[4/2/08 10:51:46:056 IST] 237a6051 SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] IdleConnectionHandler - Adding connection at: 1207113706056
[4/2/08 10:51:46:056 IST] 237a6051 SystemErr     R 2008/04/02 10:51:46:056 IST 
[DEBUG] MultiThreadedHttpConnectionManager - Notifying no-one, there are no 
waiting threads

What can be the possible reason for this? What can be the way(s) to avoid this? Regards,
  Gagneet
Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
On Thu, 2008-03-27 at 11:53 +0000, gagneet wrote:
Hi Oleg,
As I was using Singleton HttpClient object the JSESSIONID persisted for every 
request. I have cleared the persistence by calling clearCookies() method on the 
HttpState object corresponding to the HttpClient object. Should I call this 
method after every call or should I call it only if the connection is timed 
out? Please advice.

Regards,
Gagneet


Gagneet,

It really depends on how your application manages conversation state on
the client side. Usually applications are expected to maintains an
instance of HttpState per distinct user / thread of execution. This way,
you would not have to mix cookies that belong to different users, and if
an individual connection times out, the HttpState instance associated
with it could simply be discarded along with the JSESSIONID session
cookie.
Hope this helps

Oleg



---------------------------------
Why delete messages? Unlimited storage is just a click away.


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



---------------------------------
 Why delete messages? Unlimited storage is just a click away.


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

Reply via email to