Thanks Mike.

Michael Becke <[EMAIL PROTECTED]> wrote:Option 1 is the correct one, but you do not 
need to call 
client.getHttpConnectionManager().releaseConnection() manually as this 
gets done via Method.releaseConnection().

Mike

Kalnichevski, Oleg wrote:
> The former (option 1) is the correct one. The latter (option 2)
> _should_ work with the simple connection manager but it is guaranteed
> to not produce the desired effect with the multi-threaded connection
> manager
> 
> Oleg
> 
> -----Original Message----- From: Karthikeyani K
> [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 18:58
> To: Commons HttpClient Project Subject: RE: parameter of setHost
> method in HostConfiguration of httpClient
> 
> 
> Kalnichevski, I want to close the client connection once the method
> has been executed. Still I am not clear.....Here is what I
> understand...There are two ways of doing it. Which option is the
> proper way of closing a client connection. Is my understanding
> correct.
> 
> 
> 1)public class myHttpConnectionManager extends
> SimpleHttpConnectionManager public myHttpConnectionManager() {}; 
> public void releaseConnection(HttpConnection connection) { 
> super.releaseConnection(connection); connection.close(); }
> 
> 
> } HttpClient client = new HttpClient( myHttpConnectionManager); 
> 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().releaseConnection().
> 
> 
> 
> 
> or
> 
> 
> 2) HttpClient client = new HttpClient( myHttpConnectionManager); 
> 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(method.getHostConfiguration()).close().
> 
> 
> 
> 
> Does this close the connection that was used to execute the method.
> 
> 
> 
> Thanks, Karthi
> 
> 
> "Kalnichevski, Oleg" wrote:
> 
> 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" 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]
> 
> 
> 
> 
> --------------------------------- Do you Yahoo!? New and Improved
> Yahoo! Mail - Send 10MB messages!
> 
> ***************************************************************************************************
> 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]
> 

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



                
---------------------------------
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.

Reply via email to