org.jboss.resteasy.client.spring
Class RestClientProxyFactoryBean<T>

java.lang.Object
  extended by org.jboss.resteasy.client.spring.RestClientProxyFactoryBean<T>
Type Parameters:
T - The type representing the client interface.
All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean

public class RestClientProxyFactoryBean<T>
extends java.lang.Object
implements org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean

FactoryBean to generate a client proxy from a REST annotated interface.

Example: The following spring xml configuration snippet makes a bean with the id echoClient. The bean is a generated proxy of the a.b.c.Echo interface to access the remote service on http://server.far.far.away:8080/echo base URI.

 <bean id="echoClient" class="org.jboss.resteasy.client.spring.RestClientProxyFactoryBean"
 p:serviceInterface="a.b.c.Echo" p:baseUri="http://server.far.far.away:8080/echo" />
 

Author:
Attila Kiraly

Constructor Summary
RestClientProxyFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 java.net.URI getBaseUri()
           
 ClientExecutor getClientExecutor()
           
 org.apache.commons.httpclient.HttpClient getHttpClient()
           
 T getObject()
           
 java.lang.Class<T> getObjectType()
           
 ResteasyProviderFactory getResteasyProviderFactory()
           
 java.lang.Class<T> getServiceInterface()
           
 boolean isSingleton()
           
 void setBaseUri(java.net.URI baseUri)
          This is a mandatory property that needs to be set.
 void setClientExecutor(ClientExecutor clientExecutor)
          Optional property for advanced usage.
 void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
          Optional property.
 void setResteasyProviderFactory(ResteasyProviderFactory resteasyProviderFactory)
          Optional property for advanced usage.
 void setServiceInterface(java.lang.Class<T> serviceInterface)
          This is a mandatory property that needs to be set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestClientProxyFactoryBean

public RestClientProxyFactoryBean()
Method Detail

getObject

public T getObject()
            throws java.lang.Exception
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean
Throws:
java.lang.Exception

getObjectType

public java.lang.Class<T> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

getServiceInterface

public java.lang.Class<T> getServiceInterface()

setServiceInterface

public void setServiceInterface(java.lang.Class<T> serviceInterface)
This is a mandatory property that needs to be set.

Parameters:
serviceInterface - the interface for which a proxy is needed to be generated.

getBaseUri

public java.net.URI getBaseUri()

setBaseUri

public void setBaseUri(java.net.URI baseUri)
This is a mandatory property that needs to be set.

Parameters:
baseUri - the remote service base address.

getHttpClient

public org.apache.commons.httpclient.HttpClient getHttpClient()

setHttpClient

public void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
Optional property. If this property is set and clientExecutor is null, this will be used by proxy generation. This could be usefull for example when you want to use a MultiThreadedHttpConnectionManager instead of a SimpleHttpConnectionManager which is the default in HttpClient.

Parameters:
httpClient - the instance to be used by proxy generation
See Also:
ProxyFactory#create(Class, URI, HttpClient, ResteasyProviderFactory)

getClientExecutor

public ClientExecutor getClientExecutor()

setClientExecutor

public void setClientExecutor(ClientExecutor clientExecutor)
Optional property for advanced usage. If this property is set it will be used by proxy generation. If this property is set the httpClient property is ignored.

Parameters:
clientExecutor - the instance to be used by proxy generation
See Also:
ProxyFactory.create(Class, URI, ClientExecutor, ResteasyProviderFactory)

getResteasyProviderFactory

public ResteasyProviderFactory getResteasyProviderFactory()

setResteasyProviderFactory

public void setResteasyProviderFactory(ResteasyProviderFactory resteasyProviderFactory)
Optional property for advanced usage. For the most cases this property is not needed to be set.

Parameters:
resteasyProviderFactory - the instance to be used by proxy generation.


Copyright © 2010. All Rights Reserved.