T - The type representing the client interface.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" />
| Constructor and Description |
|---|
RestClientProxyFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
URI |
getBaseUri() |
ClientHttpEngine |
getClientEngine() |
org.apache.http.client.HttpClient |
getHttpClient() |
T |
getObject() |
Class<T> |
getObjectType() |
ResteasyProviderFactory |
getResteasyProviderFactory() |
Class<T> |
getServiceInterface() |
boolean |
isSingleton() |
void |
setBaseUri(URI baseUri)
This is a mandatory property that needs to be set.
|
void |
setClientExecutor(ClientHttpEngine clientEngine)
Optional property for advanced usage.
|
void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Optional property.
|
void |
setResteasyProviderFactory(ResteasyProviderFactory resteasyProviderFactory)
Optional property for advanced usage.
|
void |
setServiceInterface(Class<T> serviceInterface)
This is a mandatory property that needs to be set.
|
public Class<T> getObjectType()
getObjectType in interface org.springframework.beans.factory.FactoryBean<T>public boolean isSingleton()
isSingleton in interface org.springframework.beans.factory.FactoryBean<T>public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic void setServiceInterface(Class<T> serviceInterface)
serviceInterface - the interface for which a proxy is needed to be generated.public URI getBaseUri()
public void setBaseUri(URI baseUri)
baseUri - the remote service base address.public org.apache.http.client.HttpClient getHttpClient()
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
clientEngine is
null, this will be used by proxy generation. This could be useful for
example when you want to use a
org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
instead of a
SingleClientConnManager which
is the default in HttpClient.httpClient - the instance to be used by proxy generationpublic ClientHttpEngine getClientEngine()
public void setClientExecutor(ClientHttpEngine clientEngine)
httpClient
property is ignored.clientEngine - the instance to be used by proxy generationpublic ResteasyProviderFactory getResteasyProviderFactory()
public void setResteasyProviderFactory(ResteasyProviderFactory resteasyProviderFactory)
resteasyProviderFactory - the instance to be used by proxy generation.Copyright © 2020 JBoss by Red Hat. All rights reserved.