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: can I NOT have the cookie please
Date Wed, 09 Aug 2006 08:27:11 GMT
On Wed, 2006-08-09 at 15:41 +0800, leung cc wrote:
> Ah, finally it's all working. I can now use either the GetMethod or the 
> PostMethod to communicate with my servlet. When I used GET I coded the 
> jsessionid thing wrong - should have written ";jsessionid=..." but instead 
> I had it as "?jsessionid=...". If I use the PostMethod, I needed to send a 
> cookie to the server telling it the session I wanted.
> 

You could have just seeded the initial HTTP state with the session
cookie to achieve the same net result for all requests (GET, POST, etc) 

HttpClient httpclient = new HttpClient();
        
String sessionId = "whatever";
Cookie cookie = new Cookie(
 "www.blahblah.com.hk", "JSESSIONID", sessionId);
cookie.setPath("/");
cookie.setSecure(true);
        
httpclient.getState().addCookie(cookie);

Oleg

> But of course, whether I will have the dreaded "Connection timed out: 
> connect" problem which opened up this can of worm for me in the first place 
> remains to be seen.  I hope the following code had extended the connection 
> time out period and I will never get a timeout again:
> 
> HttpClient httpClnt = new HttpClient();
> httpClnt.getParams().setParameter( "http.socket.timeout",  new Integer( 
> 60000 ) );
> httpClnt.getHttpConnectionManager().getParams().setConnectionTimeout( 30000 
> );
> 
> 
> 
> ---------------------------------------------------------------------
> 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