Karthi,

Host configuration specified at the HTTP method level is not supposed to be propagated 
back to the HTTP client level.

Try this instead

      // Close the connection
       
client.getHttpConnectionManager().getConnection(method.getHostConfiguration()).close

Better yet, subclass the connection manager and make it always close connections upon 
release (if that is what you want). The way you are trying to get this done seems a 
little flaky to me. HttpConnectionManager#getConnection method will produce ANY 
connection for the given host config, not the one that has just been used to execute 
the request.

Cheers,

Oleg

-----Original Message-----
From: Karthikeyani K [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 16:57
To: Commons HttpClient Project
Subject: RE: parameter of setHost method in HostConfiguration of
httpClient


Thanks Kalnichevski. But I have specified the host at the method level :
        for eg:
        HttpClient client = new HttpClient();
        PostMethod method =  new PostMethod(http://test:80/test.html);
//        After executing the post method when i try to close the connection, i get 
the error message host is null
       method.releaseConnection();
      // Close the connection
       
client.getHttpConnectionManager().getConnection(client.getHostConfiguration()).close() 
  


There is a method setHost(URI uri) in HostConfiguration. So I was thinking this should 
be the URI same as that specified in the PostMethod.....i.e that of the server


Thanks,
Karthi

"Kalnichevski, Oleg" <[EMAIL PROTECTED]> wrote:

Karthi,

HostConfiguration associated with HttpClient instance represents default host 
information. These settings are used only when the target host and port are not 
explicitly specified on the HttpMethod level.

HttpClient agent = new HttpClient();
agent.getHostConfiguration().setHost("localhost", 8080);

HttpMethod absolute = new GetMethod("www.whatever.com/stuff");
// will target the host specified in the URL

HttpMethod relative = new GetMethod("/stuff");
// no host name given in the URL. Will target the default host, that is 'localhost'

Hope this clarifies things a little

Oleg




-----Original Message-----
From: Karthikeyani K [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 15:39
To: [EMAIL PROTECTED]
Subject: parameter of setHost method in HostConfiguration of httpClient


Hi,
When we set Host on the HostConfiguration of the httpClient using setHost method 
(setHost(host)), does the host correspond to the server host or the client host.

When I try to close a connection by using
cleint.getHttpConnectionmanager.getConnection(client.getHostConfiguration()).close,
I am getting the error stating host is null. So I have to set the host on the 
hostConfiguration, so does this host correspond to the server host or the client host 
itself.

Please advice.....


Thanks,
Karthi


---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

***************************************************************************************************
The information in this email is confidential and may be legally privileged. Access to 
this email by anyone other than the intended addressee is unauthorized. If you are not 
the intended recipient of this message, any review, disclosure, copying, distribution, 
retention, or any action taken or omitted to be taken in reliance on it is prohibited 
and may be unlawful. If you are not the intended recipient, please reply to or forward 
a copy of this message to the sender and delete the message, any attachments, and any 
copies thereof from your system.
***************************************************************************************************

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


        
---------------------------------
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.

***************************************************************************************************
The information in this email is confidential and may be legally privileged.  Access 
to this email by anyone other than the intended addressee is unauthorized.  If you are 
not the intended recipient of this message, any review, disclosure, copying, 
distribution, retention, or any action taken or omitted to be taken in reliance on it 
is prohibited and may be unlawful.  If you are not the intended recipient, please 
reply to or forward a copy of this message to the sender and delete the message, any 
attachments, and any copies thereof from your system.
***************************************************************************************************

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

Reply via email to