Package org.jboss.resteasy.client.spring
Class RestClientProxyFactoryBean<T>
java.lang.Object
org.jboss.resteasy.client.spring.RestClientProxyFactoryBean<T>
- Type Parameters:
T- The type representing the client interface.
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<T>,org.springframework.beans.factory.InitializingBean
public class RestClientProxyFactoryBean<T>
extends Object
implements org.springframework.beans.factory.FactoryBean<T>, 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
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidorg.jboss.resteasy.client.jaxrs.ClientHttpEngineorg.apache.http.client.HttpClientorg.jboss.resteasy.spi.ResteasyProviderFactorybooleanvoidsetBaseUri(URI baseUri) This is a mandatory property that needs to be set.voidsetClientExecutor(org.jboss.resteasy.client.jaxrs.ClientHttpEngine clientEngine) Optional property for advanced usage.voidsetHttpClient(org.apache.http.client.HttpClient httpClient) Optional property.voidsetResteasyProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory resteasyProviderFactory) Optional property for advanced usage.voidsetServiceInterface(Class<T> serviceInterface) This is a mandatory property that needs to be set.
-
Constructor Details
-
RestClientProxyFactoryBean
public RestClientProxyFactoryBean()
-
-
Method Details
-
getObject
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<T>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingletonin interfaceorg.springframework.beans.factory.FactoryBean<T>
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getServiceInterface
-
setServiceInterface
This is a mandatory property that needs to be set.- Parameters:
serviceInterface- the interface for which a proxy is needed to be generated.
-
getBaseUri
-
setBaseUri
This is a mandatory property that needs to be set.- Parameters:
baseUri- the remote service base address.
-
getHttpClient
public org.apache.http.client.HttpClient getHttpClient() -
setHttpClient
public void setHttpClient(org.apache.http.client.HttpClient httpClient) Optional property. If this property is set andclientEngineis null, this will be used by proxy generation. This could be useful for example when you want to use aThreadSafeClientConnManagerinstead of aSingleClientConnManagerwhich is the default inHttpClient.- Parameters:
httpClient- the instance to be used by proxy generation
-
getClientEngine
public org.jboss.resteasy.client.jaxrs.ClientHttpEngine getClientEngine() -
setClientExecutor
public void setClientExecutor(org.jboss.resteasy.client.jaxrs.ClientHttpEngine clientEngine) Optional property for advanced usage. If this property is set it will be used by proxy generation. If this property is set thehttpClientproperty is ignored.- Parameters:
clientEngine- the instance to be used by proxy generation
-
getResteasyProviderFactory
public org.jboss.resteasy.spi.ResteasyProviderFactory getResteasyProviderFactory() -
setResteasyProviderFactory
public void setResteasyProviderFactory(org.jboss.resteasy.spi.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.
-