Wednesday, March 4, 2009

Tiimout params for spring remoting

All properties can be set for spring remoting including connection timeout.

The HttpInvokerProxyFactoryBean takes in httpInvokerRequestExecutor as a parameter which in turn takes in httpClient(org.apache.commons.httpclient.HttpClient).

Hence all properties for HttpClient as timeout , connectiontime etc can be set.

Code snippet for injecting httpclient into the connection object(with timeout for 5 seconds)

<bean id="httpParamObject"
class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor">
<property name="httpClient">
<bean class="org.apache.commons.httpclient.HttpClient">
<property name="timeout" value="5000" />
</bean>
</property>
</bean>

<bean id="testServer"
class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl"
value="http://10.1.66.109:8080/server/TestServer" />
<property name="serviceInterface"
value="com.pg.server.IServerImpl" />
<property name="httpInvokerRequestExecutor" ref=" httpParamObject" />

</bean>

No comments:

 
Free Domain Names @ .co.nr!