PDA

View Full Version : HttpInvokerProxyFactoryBean timeout



jv
Feb 6th, 2006, 06:22 AM
Hi,

I've had a look at the APIs but can't seem to find a place where I can set a timeout on the HttpInvokerProxyFactoryBean. Is there any way to do this?

Thanks

jv

jbalint
Feb 6th, 2006, 09:01 AM
You will want to use the CommonsHttpInvokerRequestExecutor class. You can set it up like so:



<bean id="httpClient" class="org.springframework.remoting.httpinvoker.CommonsHt tpInvokerRequestExecutor">
<property name="httpClient">
<bean class="org.apache.commons.httpclient.HttpClient">
<property name="connectionTimeout" value="2000"/>
</bean>
</property>
</bean>

<bean id="someServiceClient" class="org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean">
<property name="serviceUrl" value="xxx"/>
<property name="serviceInterface" value="xxx"/>
<property name="httpInvokerRequestExecutor" ref="httpClient"/>
</bean>


However you'll notice that in Commons HTTP Client 3.0, the 'setConnectionTimeout' method of the HttpClient class is deprecated. This means you should instead use the HTTP Client's HttpConnectionManager and HttpConnectionManagerParams classes to set this up.

Jess

jv
Feb 6th, 2006, 09:29 AM
Thanks Jess - that works perfectly!

jv

pfn
Mar 22nd, 2006, 01:12 PM
Is there any way to timeout already established connections?

I.e. if my remote service is responding too slowly, abort the connection?