You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Jilles van Gurp <ji...@jillesvangurp.com> on 2004/11/17 09:44:06 UTC

replacement for deprecated startsession

Hi,

I have the following piece of code:
URL url = new URL(location);
HttpClient client = new HttpClient();
client.startSession(url);

Since startSession is deprecated I thought that I could replace it with 
the following line:
client.getHostConfiguration().setHost(url.getHost());

However that doesn't seem to work and we get an error about a problem 
with connecting to the host. The javadoc doesn't say anything more than 
to use getHostConfiguration which is what I'm doing so could you please 
inform me of the correct way to replace the startSession call?

Regards,

Jilles van Gurp

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


Re: replacement for deprecated startsession

Posted by Oleg Kalnichevski <ol...@apache.org>.
Jilles,

There's no replacement for startSession. HTTP is a request/response
oriented protocol that does not (ugly hack called cookies
notwithstanding) support the concept of a session. 

Please refer to the HttpClient tutorial for details on recommended use
patterns

http://jakarta.apache.org/commons/httpclient/tutorial.html

Cheers,

Oleg


On Wed, Nov 17, 2004 at 09:44:06AM +0100, Jilles van Gurp wrote:
> Hi,
> 
> I have the following piece of code:
> URL url = new URL(location);
> HttpClient client = new HttpClient();
> client.startSession(url);
> 
> Since startSession is deprecated I thought that I could replace it with 
> the following line:
> client.getHostConfiguration().setHost(url.getHost());
> 
> However that doesn't seem to work and we get an error about a problem 
> with connecting to the host. The javadoc doesn't say anything more than 
> to use getHostConfiguration which is what I'm doing so could you please 
> inform me of the correct way to replace the startSession call?
> 
> Regards,
> 
> Jilles van Gurp
> 
> ---------------------------------------------------------------------
> 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