Package org.apache.cxf.jaxrs.client
Class JAXRSClientFactoryBean
java.lang.Object
org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
org.apache.cxf.endpoint.AbstractEndpointFactory
org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean
- All Implemented Interfaces:
org.apache.cxf.interceptor.InterceptorProvider
- Direct Known Subclasses:
JAXRSClientFactoryBeanDefinitionParser.JAXRSSpringClientFactoryBean
public class JAXRSClientFactoryBean
extends org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected ClientStateprotected static final Loggerprotected Stringprotected ClassLoaderprotected Class<?>protected booleanprotected longprotected StringFields inherited from class org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean
entityProviders, schemaLocations, serviceFactoryFields inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory
address, bindingConfig, bindingFactory, bindingId, bus, conduitSelector, dataBinding, destinationFactory, endpointName, endpointReference, features, properties, publishedEndpointUrl, serviceName, transportId -
Constructor Summary
ConstructorsConstructorDescriptionJAXRSClientFactoryBean(org.apache.cxf.jaxrs.JAXRSServiceFactoryBean serviceFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyFeatures(AbstractClient client) create()Create a Client instance.<T> TCreates a proxy.protected ClientProxyImplcreateClientProxy(org.apache.cxf.jaxrs.model.ClassResourceInfo cri, boolean isRoot, ClientState actualState, Object[] varValues) Creates a WebClient instancecreateWithValues(Object... varValues) Create a Client instance.protected ClientStateprotected org.apache.cxf.endpoint.ConduitSelectorgetConduitSelector(org.apache.cxf.endpoint.Endpoint ep) protected <C extends jakarta.ws.rs.core.Configurable<C>>
jakarta.ws.rs.core.Configurable<?>getConfigurableFor(C context) Gets the initial headersGets the passwordClass<?>Returns the service class.Gets the user nameprotected voidinitClient(AbstractClient client, org.apache.cxf.endpoint.Endpoint ep, boolean addHeaders) protected voidnotifyLifecycleManager(Object client) voidsetClassLoader(ClassLoader loader) Sets the custom class loader to be used for creating proxies.voidsetHeaders(Map<String, String> map) Sets the headers new proxy or WebClient instances will be initialized with.voidsetInheritHeaders(boolean ih) Indicates if the headers set by a current proxy will be inherited when a subresource proxy is created vice versa.voidsetInitialState(ClientState initialState) Sets the initial client state, can be a thread-safe state.voidsetPassword(String password) Sets the password.voidsetResourceClass(Class<?> cls) Sets the resource classvoidsetSecondsToKeepState(long time) Sets the time a thread-local client state will be kept.voidsetServiceClass(Class<?> cls) Sets the service class, may be called from a Spring handlervoidsetThreadSafe(boolean threadSafe) Indicates if a single proxy or WebClient instance can be reused by multiple threads.voidsetUsername(String username) Sets the username.Methods inherited from class org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean
checkResources, createBindingInfo, createEndpoint, createEndpointInfo, getBus, getProviders, getServiceFactory, isValidClassResourceInfo, setBus, setDataBindingProvider, setModelBeans, setModelBeans, setModelBeansWithServiceClass, setModelRef, setModelRefWithServiceClass, setProvider, setProviderComparator, setProviders, setSchemaLocation, setSchemaLocations, setServiceFactory, setServiceName, setupFactoryMethods inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory
addToBeans, checkPrivateEndpoint, getAddress, getBindingConfig, getBindingFactory, getBindingId, getBus, getConduitSelector, getDataBinding, getDestinationFactory, getEndpointName, getFeatures, getProperties, getProperties, getPublishedEndpointUrl, getServiceName, getTransportId, initializeAnnotationInterceptors, initializeAnnotationInterceptors, initializeAnnotationInterceptors, setAddress, setBindingConfig, setBindingFactory, setBindingId, setConduitSelector, setDataBinding, setDestinationFactory, setEndpointName, setEndpointReference, setFeatures, setProperties, setPublishedEndpointUrl, setTransportIdMethods inherited from class org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptors
-
Field Details
-
LOG
-
username
-
password
-
inheritHeaders
protected boolean inheritHeaders -
headers
-
initialState
-
threadSafe
protected boolean threadSafe -
timeToKeepState
protected long timeToKeepState -
serviceClass
-
proxyLoader
-
-
Constructor Details
-
JAXRSClientFactoryBean
public JAXRSClientFactoryBean() -
JAXRSClientFactoryBean
public JAXRSClientFactoryBean(org.apache.cxf.jaxrs.JAXRSServiceFactoryBean serviceFactory)
-
-
Method Details
-
setClassLoader
Sets the custom class loader to be used for creating proxies. By default the class loader of the given serviceClass will be used.- Parameters:
loader-
-
setThreadSafe
public void setThreadSafe(boolean threadSafe) Indicates if a single proxy or WebClient instance can be reused by multiple threads.- Parameters:
threadSafe- if true then multiple threads can invoke on the same proxy or WebClient instance.
-
setSecondsToKeepState
public void setSecondsToKeepState(long time) Sets the time a thread-local client state will be kept. This property is ignored for thread-unsafe clients- Parameters:
time- secondsToKeepState
-
getUsername
Gets the user name- Returns:
- the name
-
setUsername
Sets the username. Setting the username and password is a simple way to create a Basic Authentication token.- Parameters:
username- the user name
-
getPassword
Gets the password- Returns:
- the password
-
setPassword
Sets the password. Setting the username and password is a simple way to create a Basic Authentication token.- Parameters:
password- the password
-
setInheritHeaders
public void setInheritHeaders(boolean ih) Indicates if the headers set by a current proxy will be inherited when a subresource proxy is created vice versa.- Parameters:
ih- if set to true then the current headers will be inherited
-
setResourceClass
Sets the resource class- Parameters:
cls- the resource class
-
setServiceClass
Sets the service class, may be called from a Spring handler- Parameters:
cls- the service class
-
getServiceClass
Returns the service class. -
setHeaders
Sets the headers new proxy or WebClient instances will be initialized with.- Parameters:
map- the headers
-
getHeaders
Gets the initial headers- Returns:
- the headers
-
createWebClient
Creates a WebClient instance- Returns:
- WebClient instance
-
notifyLifecycleManager
-
getActualState
-
create
Creates a proxy.- Parameters:
cls- the proxy classvarValues- optional list of values which will be used to substitute template variables specified in the class-level JAX-RS Path annotations- Returns:
- the proxy
-
create
Create a Client instance. Proxies and WebClients are Clients.- Returns:
- the client
-
createWithValues
Create a Client instance. Proxies and WebClients are Clients.- Parameters:
varValues- optional list of values which will be used to substitute template variables specified in the class-level JAX-RS Path annotations- Returns:
- the client
-
createClientProxy
protected ClientProxyImpl createClientProxy(org.apache.cxf.jaxrs.model.ClassResourceInfo cri, boolean isRoot, ClientState actualState, Object[] varValues) -
getConduitSelector
protected org.apache.cxf.endpoint.ConduitSelector getConduitSelector(org.apache.cxf.endpoint.Endpoint ep) -
initClient
protected void initClient(AbstractClient client, org.apache.cxf.endpoint.Endpoint ep, boolean addHeaders) -
getConfigurableFor
protected <C extends jakarta.ws.rs.core.Configurable<C>> jakarta.ws.rs.core.Configurable<?> getConfigurableFor(C context) -
applyFeatures
-
setInitialState
Sets the initial client state, can be a thread-safe state.- Parameters:
initialState- the state
-