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 Ole Matzura <ol...@eviware.com> on 2005/11/03 22:41:46 UTC

proxy and connection questions..

Hi all,

I'm the auther of a new soap utility (www.soapui.org) which uses 
httpclient for its internal request submittal, thanks for a great 
library! I have 2 questions that have come from soapui's users;

1) proxy command line settings; I use the 
MultiThreadedHttpConnectionManageras described in the tutorial for 
multithreading, my PostMethod is executed as follows;

httpclient.executeMethod( new HostConfiguration(), postMethod, new 
HttpState() );

in this scenario, httpclient does not seem to pick up the command line 
-Dhttp.proxyHost=server.domain -Dhttp.proxyPort=80 properties. Do I have 
to assign these myself in the HostConfiguration object or is there any 
way of telling httpclient that it should use these properties?

2) connection-closing; one user of soapui observed the following when 
using soapui together with tcpmon; "Usually, a connection req/response 
shows up in tcpmon immediately. However, when using soapui, it will not 
show up for a while, or until I quit soapui. Is soapui holding the 
httpconnection open? Is there a way to force a close after each request, 
or each test script?"

my guess that is due to the fact that I never actually close the 
connection, I just call the postMethod.releaseConnection(). Is there any 
way to force its closing even though I am using the 
MultiThreadedHttpConnectionManager?

huge thanks for your help and efforts!

regards,

Ole


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


Re: proxy and connection questions..

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, Nov 03, 2005 at 10:41:46PM +0100, Ole Matzura wrote:
> Hi all,
> 
> I'm the auther of a new soap utility (www.soapui.org) which uses 
> httpclient for its internal request submittal, thanks for a great 
> library! I have 2 questions that have come from soapui's users;
> 
> 1) proxy command line settings; I use the 
> MultiThreadedHttpConnectionManageras described in the tutorial for 
> multithreading, my PostMethod is executed as follows;
> 
> httpclient.executeMethod( new HostConfiguration(), postMethod, new 
> HttpState() );
> 
> in this scenario, httpclient does not seem to pick up the command line 
> -Dhttp.proxyHost=server.domain -Dhttp.proxyPort=80 properties. Do I have 
> to assign these myself in the HostConfiguration object or is there any 
> way of telling httpclient that it should use these properties?
> 

You have to assign those values yourself


> 2) connection-closing; one user of soapui observed the following when 
> using soapui together with tcpmon; "Usually, a connection req/response 
> shows up in tcpmon immediately. However, when using soapui, it will not 
> show up for a while, or until I quit soapui. Is soapui holding the 
> httpconnection open? Is there a way to force a close after each request, 
> or each test script?"
> 
> my guess that is due to the fact that I never actually close the 
> connection, I just call the postMethod.releaseConnection().

This is correct

Is there any 
> way to force its closing even though I am using the 
> MultiThreadedHttpConnectionManager?
> 

There are three ways to go about the problem

(1) Send 'Connection: close' header with each request in order to tell
the origin server to close connection

(2) Implement a custom connection manager or extend the existing one and
override its releaseConnection method

(3) Implement a custom idle connection handler that can drop idle
connections after a certain period of inactivity

Hope this helps

Oleg

> huge thanks for your help and efforts!
> 
> regards,
> 
> Ole
> 
> 
> ---------------------------------------------------------------------
> 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